Relation in probability As part of the solution of an exercise I have the following relation:
$$\sum_{k=0}^{\infty}k(1-p)^{k-1}=\frac{1}{(1-(1-p))^2}$$
Where $p$ is a probability.
I don't understand where this is coming from?
 A: Hints:
For $\,x\in\Bbb R\;,\;\;|x|<1\,$ , we have the well known power series development
$$\frac1{1-x}=\sum_{n=0}^\infty x^n\stackrel{\text{differentiation}}\implies\frac1{(1-x)^2}=\sum_{n=1}^\infty nx^{n-1}$$
But $\;p\,$ is probability, so $\;0\le p<1\;\ldots$ (if $\,p=1\,$ the claim in your question is trivial)
A: Note that 
$$f(p)=1+p+p^2+p^3+\ldots= 1+p(1+p+p^2+p^3+\ldots)=1+p f(p)$$
from which you get that $f(p)=\frac{1}{1-p}$.
Next notice that
$$g(p)=1+2p+3p^2+4p^3+\ldots=(1+p+p^2+p^3+\ldots)+p(1+2p+3p^2+4p^3+\ldots)=\frac{1}{1-p}+p g(p)$$
from which you get that $g(p)=\frac{1}{(1-p)^2}$.
A: If $S=\sum_{1\le r\le n} r ab^{r-1}$
$b\cdot S=\sum_{1\le r\le n} r ab^r$
$$\implies S(1-b)=a(1+b+b^2+\cdots+b^{n-1})-nab^n$$
$$=a\frac{1-b^n}{1-b}- a(n b^n)$$
If $|b|<1, \lim_{n\to\infty}b^n=0$ and from this,$$\text{ if } |b|<1,\lim_{n\to\infty} nb^n=0\text{  [Proof Below] }$$ 
$$\implies \lim_{n\to\infty}S(1-b)=\frac a{1-b}\text{ if }|b|<1$$
Here $a=1, r=1-p$ and as $0\le p\le 1\iff 0\le 1-p\le 1$
$p=1$ will make each summand $=0$
[
If $|b|<1,$ let $c=\frac1b$
$$\lim_{n\to\infty} nb^n=\lim_{n\to\infty} \frac n{c^n}=\lim_{n\to\infty} \frac1{nc^{n-1}\ln c}=0$$ as $|c|>1$
]
