How do you prove by induction that $\frac{1}{2} + \frac{2}{2^2} + \ldots + \frac{n}{2^n} = 2 - \frac{n+2}{2^n}$? For $n=1$ this is true because $\frac{1}{2^{1}}=2-\frac{1+2}{2^{1}}=\frac{1}{2}$. Further, it is a little more complicated, can we now assume that this is true up to the number $n-1$? Then do the induction step from $n-1$ to $n$.
So what I've tried:
$$\frac{1}{2}+\frac{1}{2^{2}}+\ldots+\frac{n-1}{2^{n-1}}+\frac{n}{2^{n}}=$$
$$=2-\frac{n+1}{2^{n-1}}+\frac{n}{2^{n}}=$$

You can write this sum using sigma notation, for clarity.

$\frac{1}{2} +\frac{2}{2^2} + \dots+\frac{n}{2^n} = \sum_{i=1}^{n} \frac{i}{2^i} = 2-\frac{n+2}{2^n}.$ (*)

Let our induction hypothesis $P(n)$ be the equation (*).
Let's apply mathematical induction now.
Base case $(n=1):$ $$\sum_{i=1}^{1} \frac{i}{2^i} = \frac{1}{2^1} = \frac{1}{2} = 2-\frac{1+2}{2^1} = 2-\frac{3}{2} = \frac{1}{2}$$ $P(1)$ holds. $\blacksquare$
Inductive step: Assume $P(n)$ holds for some $n \geq 1.$ Show that $P(n+1)$ holds.
Since $P(n)$ holds, we can write
$$\sum_{i=1}^{n} \frac{i}{2^i} = 2-\frac{n+2}{2^n}$$
$$\sum_{i=1}^{n} \frac{i}{2^i} + \frac{n+1}{2^{n+1}}= 2-\frac{n+2}{2^n}+\frac{n+1}{2^{n+1}}$$
$$\sum_{i=1}^{n+1} \frac{i}{2^i} = 2+\frac{(-2)\cdot(n+2) + (n+1)}{{2}^{n+1}}$$
$$\sum_{i=1}^{n+1} \frac{i}{2^i} = 2+\frac{-n-3}{{2}^{n+1}}$$
$$\sum_{i=1}^{n+1} \frac{i}{2^i} = 2-\frac{n+3}{{2}^{n+1}}$$
$$\sum_{i=1}^{n+1} \frac{i}{2^i} = 2-\frac{(n+1)+2}{{2}^{n+1}}$$
Since $P(n)$ holds for $n+1$, our induction hypothesis is true $\forall n \geq 1.$ $\blacksquare$
