I have the sum $$\sum_{i=0}^n i\cdot a^i$$ and according to wolframalpha, the partial sum evaluates to $$ \frac{a (n\ a^{n + 1} - (n + 1) a^n + 1)}{(a - 1)^2}.$$ How does one arrive at the above formula? The usual trick of expanding the sum and subtracting partial sums to arrive at a closed form doesn't seem to work here.
3 Answers
One may start with the standard evaluation: $$ 1+x+x^2+\cdots+x^n=\frac{1-x^{n+1}}{1-x}, \quad |x|<1. \tag1 $$ Then by differentiating $(1)$ with respect to $x$ we have $$ 1+2x+3x^2+\cdots+nx^{n-1}=\frac{1-x^{n+1}}{(1-x)^2}-\frac{(n+1)x^{n}}{1-x}, \quad |x|<1. \tag2 $$

- 120,989
Other Way
Notation: $\Delta f(x)=f(x+1)-f(x),$ and $g(k)]^{\;n+1}_{\;0}=g(n+1)-g(0)$
To find a closed form for the sum $$\sum^{n}_{k=0}ka^k, $$
we can use the summation by parts $$ \sum^{n}_{k=0}g(k)\Delta f(k)=f(k).g(k)]^{\;n+1}_{\;0}-\sum^{n}_{k=0}f(k+1).\Delta g(k),$$
we take $g(k)=k$ and $\Delta f(k)= a^k$, so $f(k)= \frac{a^k}{a-1}$ and $\Delta g(k)=1$, then
$$\sum^{n}_{k=0}k\Delta \frac{a^k}{a-1} =\frac{a^k}{a-1}.k]^{\;n+1}_{\;0}-a\sum^{n}_{k=0}\frac{a^k}{a-1}=\frac{a^{n+1}}{a-1}.(n+1) - \frac{a}{a-1} \frac{a^{n+1}-1}{a-1} ,$$
simplifying the expression we get
$$\sum^{n}_{k=0}ka^k= \frac{a^{n+1}[(a-1)(n+1)-a] +a}{(a-1)^2} .$$

- 783
You can compute the sum by interchanging the order of summation. Indeed $$ \sum_{i=0}^n i\cdot a^i =\sum_{i=1}^{n}\sum_{j=1}^{i}a^{i} =\sum_{j=1}^{n}\sum_{i=j}^{n}a^{i} =\sum_{j=1}^{n}\frac{a^{j}-a^{n+1}}{1-a} =\frac{a-a^{n+1}}{(1-a)^2}-\frac{na^{n+1}}{1-a}. $$ But $$ \frac{a-a^{n+1}}{(1-a)^2}-\frac{na^{n+1}}{1-a}= \frac{a (n\ a^{n + 1} - (n + 1) a^n + 1)}{(a - 1)^2} $$ as desired.

- 31,116