I am reading some combinatorics books. And here author first obtained a sum answer for a problem and then converted it to formula without explaining it. Just writing equality sign. This is that expression: $$2(2\sum_{k=1}^{n-1} k(k-1) + n(n-1)) = 2(\frac{1}{3}(n-1)n(2n-1)-n(n-1)+n(n-1)) = \frac{2}{3}n(n-1)(2n-1)$$
The main question is "How did he get this?". I often face with this problem where I need to convert such sums into formula. And additionally, I'll really appreciate if you show some technics to do this.
You should be familiar with Faulhaber's formula, not to memorize but to know it exists and where to look it up. Then $$\sum_{k=1}^{n-1}k(k-1)=\sum_{k=1}^{n-1}k^2-k\\=\frac 16(n-1)n(2n-1)-\frac 12(n-1)n$$