I'm new to doing proofs by induction and am having trouble. I am wondering if a sum having an upper bound not equal to $n$ changes the problem. The initial is
$$\sum_{i=0}^{n-1} \frac{i}{2^i} = 2 - \frac{n+1}{2^{n-1}}$$
I can do the base case where $n = 1$. However, because of the bound, I'm not sure what to do next. I'm not sure what to do with the bounds because when I did
$$2 - \frac{k+1}{2^{k-1}}+\frac{k+1}{2^{k+1}}$$
which is $\sum_{i=0}^{k-1} \frac{i}{2^i}$ + $P(k+1)$ I ended up with $$2 - \frac{{(k+1)}{(2^{k+1}+2^{k-1}})}{2^{2k}}$$ which I cannot figure out how to use to solve the proof, and I'm not confident that it's correct.
Since the bound ends at $k-1$, not $k$, should I set up the second part as $$2 - \frac{k+1}{2^{k-1}}+\frac{k}{2^{k}}?$$
\begin{align} \sum_{i\le n}\frac{i}{2^i}&=\sum_{i\le n-1}\frac{i}{2^i}+\frac{n}{2^n} \\ &=\left(2-\frac{n+1}{2^{n-1}}\right)+\frac{n}{2^n} \\ &=2-\frac{2n+2}{2^{n}}+\frac{n}{2^n} \\ &=2-\frac{n+2}{2^{n}}. \end{align}