# How do you solve the following sum?

How do you solve this sum:

$$\sum_{n=0}^{\infty}2^n\left(1-e^{2^{-n-1}k}\right)^2$$

I know the result is $$e^k - 1 - k$$. Where can I find some lectures or materials about solving such problems?

Let $$k\in\mathbb{R}$$, we have :
\begin{aligned} \sum_{n=0}^{+\infty}{2^{n}\left(1-\mathrm{e}^{\frac{k}{2^{n+1}}}\right)^{2}}&=\sum_{n=0}^{+\infty}{\left(2^{n}-2^{n+1}\,\mathrm{e}^{\frac{k}{2^{n+1}}}+2^{n}\,\mathrm{e}^{\frac{k}{2^{n}}}\right)}\\ &=\sum_{n=0}^{+\infty}{\left(2^{n+1}-2^{n}-2^{n+1}\,\mathrm{e}^{\frac{k}{2^{n+1}}}+2^{n}\,\mathrm{e}^{\frac{k}{2^{n}}}\right)}\\ &=\sum_{n=0}^{+\infty}{\left(2^{n+1}\left(1-\mathrm{e}^{\frac{k}{2^{n+1}}}\right)-2^{n}\left(1-\mathrm{e}^{\frac{k}{2^{n}}}\right)\right)}\\ \sum_{n=0}^{+\infty}{2^{n}\left(1-\mathrm{e}^{\frac{k}{2^{n+1}}}\right)^{2}}&=\sum_{n=0}^{+\infty}{\left(u_{n+1}-u_{n}\right)}\end{aligned}
Where $$\left(u_{n}\right)_{n}$$ is a numerical sequence defined as follows : $$\left(\forall n\in\mathbb{N}\right),\ u_{n}=2^{n}\left(1-\mathrm{e}^{\frac{k}{2^{n}}}\right)$$
Since $$\left(u_{n}\right)_{n}$$ does converge to a limit $$\ell$$, using the fact that $$\lim\limits_{x\to 0}{\frac{\mathrm{e}^{x}-1}{x}}=0$$, we get that $$\ell =-k$$, we have that $$\sum\limits_{n\geq 0}{\left(u_{n+1}-u_{n}\right)}$$ is a telescopic series that converges, and $$\sum\limits_{n=0}^{+\infty}{\left(u_{n+1}-u_{n}\right)}=\ell -u_{0}=-k-1+\mathrm{e}^{k}.$$
Thus : $$\sum_{n=0}^{+\infty}{2^{n}\left(1-\mathrm{e}^{\frac{k}{2^{n+1}}}\right)^{2}}=\mathrm{e}^{k}-k-1.$$