Show that if $a\neq 1$, then $\sum_{k=0}^{n-1}ka^k = \frac{1-na^{n-1}+(n-1)a^n}{(1-a)^2}$ 
Need to show that if $a\neq 1$, then 
  $$\sum_{k=0}^{n-1}ka^k = \frac{1-na^{n-1}+(n-1)a^n}{(1-a)^2}$$

Here is my attempt:
$$\begin{aligned}
S & =\sum_{k=0}^{n-1}ka^k \\
&= \sum_{k=0}^{n}(k-1)(a^{k-1}) \\
\end{aligned}$$
from here we can say:
$$\begin{aligned}
S & =(1-1)(a^{1-1})+(2-1)(a^{2-1})+(3-1)(a^{3-1})+...+(n-1)(a^{n-1})\\
& =(0)(a^{0})+(1)(a^{1})+(2)(a^{2})+(3)(a^{3})+...+(n-1)(a^{n-1})\\
& =a+2a^2+3a^3+(n-1)(a^{n-1})\\
\end{aligned}$$
now compute $(a)S$:
$$\begin{aligned}
(a)S & =(a)(a)+(a)(2a^2)+(a)(n-1)(a^{n-1})\\
& =a^2+2a^3+(n-1)(a^{n-1+1})\\
& =a^2+2a^3+(n-1)(a^{n})\\
\end{aligned}$$
now compute $S-(a)S$:
$$\begin{aligned}
S-(a)S & = a+2a^2+3a^3+(n-1)(a^{n-1})-[a^2+2a^3+(n-1)(a^{n})]\\
& = a+2a^2+3a^3+(n-1)(a^{n-1})-a^2-2a^3-(n-1)(a^{n})\\
& = a+a^2+a^3+(n-1)(a^{n-1})-(n-1)(a^{n})\\
\end{aligned}$$
re-writing above:
$$(1-a)S = a+a^2+a^3+(n-1)(a^{n-1})-(n-1)(a^{n})$$
dividing both-sides by $(1-a)$:
$$S = \frac{a+a^2+a^3+(n-1)(a^{n-1})-(n-1)(a^{n})}{1-a}$$
Am I on the right track so far? If not, please point out where I went wrong.
Also, any examples would be very appreciated.
Update:
A lot of people have provided answers, however, no one has pointed out what is wrong with my current approach? I am looking to learn not to copy any answer. Please consider my "solution" and help direct me. Honestly I don't even want the final solution, I just want help understanding how to answer this. I really appreciate all the effort and time put.

for $1 \le m \le n-1$, set
$$
S_m =  a^m + \cdots + a^{n-1} = \frac{a^m -a^n}{1-a}
$$
then
$$
\sum_{k=0}^{n-1} ka^k = \sum_{m=1}^{n-1} S_m =(1-a)^{-1}\sum_{m=1}^{n-1}(a^m-a^n) \\ =(1-a)^{-2}\left( a-a^n-(n-1)a^n(1-a) \right) \\
= \frac{a-na^n+(n-1)a^{n+1}}{(1-a)^2}
$$
