# Need to know why $\sum_{k=0}^{\infty}kr^{k} = \frac{r}{(1-r)^{2}}$

Working on a Stat problem where I must find $E(x)$ of $f(x)=\left(\frac{1}{2}\right)^{x+1}$ for $x=0,1,2,\cdots$

I have,

$$E(x)=\sum_{x=0}^{\infty}x\left(\frac{1}{2}\right)^{x+1}=\frac{1}{2}\sum_{x=0}^{\infty}x\left(\frac{1}{2}\right)^{x}$$

I'm pretty sure this is a geometric series, but it would defeat the purpose of doing this problem if I didn't know why the following sum converges:

$$\sum_{k=0}^{\infty}kr^{k} = \frac{r}{(1-r)^{2}}$$

Can anyone explain why this is? I've tried using derivative but keep going in circles.

Since $1+r+r^2+r^3+\cdots=\frac{1}{1-r}$ for $|r|<1$,
$1+2r+3r^2+4r^3+\cdots=\frac{1}{(1-r)^2}$ for $|r|<1$ and so
$r+2r^2+3r^3+4r^4+\cdots=\frac{r}{(1-r)^2}$ for $|r|<1$.