I'm trying to calculate $S$ where $$S=\frac{1}{2}+\frac{3}{2^2}+\frac{5}{2^3}+\frac{7}{2^4}+...+\frac{2n-1}{2^n}+...$$
I know that the answer is $3$, and I also know "the idea" of how to get to the desired outcome, but I can't seem to actually go through with the proof.
The idea for solving this question is: First we will only work on the partial sum $S_n$ and once we find a closed form for it, we will limit $n$ to $\infty$ to find our answer. Notice that for example $\frac{3}{2^2}$ can be rewritten as $\frac{1}{2^2}+\frac{2}{2^2}$, knowing this, we can write $S_n$ a bit differently:
$$S_n=(\frac{1}{2}+\frac{1}{2^2}+\frac{1}{2^3}+\frac{1}{2^4}+...+\frac{1}{2^n})+\frac{2}{2^2}+\frac{4}{2^3}+\frac{6}{2^4}+...+\frac{2n-2}{2^n}$$
Notice that the part in the brackets is a finite sum that we can calculate, we know it converges to $1$ when $n$ approaches $\infty$
And now we can repeat the process again for what's not in the brackets and we can repeat this an infinite amount of times.
And if we keep going like that, we will indeed see that the sequence of whats in the bracket is: $1,1,\frac{1}{2},\frac{1}{4},\frac{1}{8}...$ and if we sum them all up it will converge to the desired outcome which is $3$.
And that is exactly what I am having problems showing, that the sequence of whats in the brackets at each step is $\frac{1}{2^k}$.
I hope this was clear enough, it is a bit difficult to explain it, and my english is not perfect so I apologize in advance.
Hint
From an algebraic point of view, consider $$S=\sum_{n=1}^{\infty}(2n-1)x^n$$ and you can write $$S=2x\sum_{n=1}^{\infty}n x^{n-1}-\sum_{n=1}^{\infty} x^{n}$$ I am sure that you can take from here. When you finish, replace $x$ by $\frac12$.