The sum of k times the kth power of a is given analytically by? I was wondering how would someone derive (Not prove) the result in terms of n and a of the following sum:
$$\sum_{k=1}^n ka^k$$ 
My question basically is, given that summation how would you tackle the problem in order to get to a solution such as, for example, this: 
$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$
 A: The trick is to eliminate the $k$ in the sum by integrating:
$$\begin{align*}
\sum_{k = 1}^n ka^k & ~=~ a \sum_{k = 1}^n k a^{k - 1} \\
& ~=~ a \sum_{k = 1}^n \frac{d}{da} \left ( \int ka^{k - 1} \ da\right ) \\
& ~=~ a \frac{d}{da} \left (  \sum_{k = 1}^n \int ka^{k - 1} \ da \right ) \\
& ~=~ a \frac{d}{da} \left ( \sum_{k = 1}^n \left ( a^k + h \right  ) \right ) \\
& ~=~ a \frac{d}{da} \left ( \frac{a^{n + 1} - a}{a - 1} + hn \right ) \\
& ~=~ a \left ( \frac{na^{n + 1} - na^n - a^n + 1}{(a - 1)^2}\right ) \\
& ~=~ \frac{na^{n + 2} - na^{n + 1} -a^{n + 1} + a}{(a - 1)^2}
\end{align*}$$
Alternatively, you can differentiate the geometric sum:
$$\begin{align*}
\sum_{k = 1}^n a^k = \frac{a^{n + 1} - a}{a - 1}
& \rightarrow ~ \frac{d}{da} \left ( \sum_{i = 1}^k a^k \right )  = \frac{d}{da} \left ( \frac{a^{n + 1} - a}{a - 1} \right )\\
& \rightarrow ~ \sum_{i = 1}^k ka^{k - 1} = \frac{na^{n + 1} - na^n - a^n + 1}{(a - 1)^2} \\
& \rightarrow ~ \sum_{i = 1}^k ka^k = \frac{na^{n + 2} - na^{n + 1} - a^{n + 1} + a}{(a - 1)^2}
\end{align*}$$
