<s>[INST] Why $\sum_{k=1}^{\infty} \frac{k}{2^k} = 2$? Can you please explain why
$$
\sum_{k=1}^{\infty} \dfrac{k}{2^k} =
\dfrac{1}{2} +\dfrac{ 2}{4} + \dfrac{3}{8}+ \dfrac{4}{16} +\dfrac{5}{32} + \dots =
2
$$
I know $1 + 2 + 3 + ... + n = \dfrac{n(n+1)}{2}$
 [/INST] Consider the function
$$
f(z) = \sum_{i=0}^{\infty}\frac{z^i}{2^i} = \frac z{2-z}.
$$
Its radius of convergence is $2$.
Its derivative is
$$
f'(z) = \sum_{i=1}^{\infty}\frac{i}{2^i}z^{i-1} = \frac 2{(2-z)^2}.
$$
Since $1<2$, it is allowed to evaluate the derivative at $z=1$ with the written formula and obtain
$$
\sum_{i=1}^{\infty}\frac{i}{2^i} = f'(1) = \frac 2{(2-1)^2} = 2.
$$
</s>