How can $S_n=n$ for the series $$S_n=\frac{1}{2}+\frac{3}{4}+\frac{7}{8}+\frac{15}{16}+\cdots$$
My try:
We can Re-write $S_n$ as
$$S_n=\frac{0+1}{2}+\frac{1+2}{2^2}+\frac{3+2^2}{2^3}+\frac{7+2^3}{2^4}+\cdots \frac{2^{n-1}-1+2^{n-1}}{2^n}$$
So we get
$$S_n=\frac{1}{2}+\frac{1}{2}+\cdots+\frac{1}{2}+\left(\frac{1}{2^2}+\frac{3}{2^3}+\frac{7}{2^4}+\cdots\right)$$
Hence
$$S_n=\frac{n}{2}+\frac{S_n}{2}$$
Hence
$$S_n=n$$
But the actual answer is entirely different. Whats wrong in my solution?
Your solution is not quite correct because $S_n$ has terms from $\frac{1}{2}$ to $\frac{2^n - 1}{2^n}$, but with your adjusted value, the terms on the right are missing the last value of $S_n$. Thus, the appropriate expression is$$\begin{equation}\begin{aligned} S_n & = \frac{n}{2} + \frac{S_n - \frac{2^{n} - 1}{2^{n}}}{2} \\ 2S_n & = n + S_n - \left(1 - \frac{1}{2^{n}}\right) \\ 2S_n & = n + S_n - 1 + \frac{1}{2^{n}} \\ S_n & = n - 1 + \frac{1}{2^{n}} \end{aligned}\end{equation}\tag{1}\label{eq1}$$
As an alternate solution method, note you have
$$\begin{equation}\begin{aligned} S_n & = \frac{2-1}{2} + \frac{4-1}{4} + \ldots + \frac{2^n-1}{2^n} \\ & = 1 - \frac{1}{2} + 1 - \frac{1}{4} + \ldots + 1 - \frac{1}{2^n} \\ & = (1 + 1 + \ldots + 1) - \left(\frac{1}{2} + \frac{1}{4} + \ldots + \frac{1}{2^n}\right) \\ & = n - \frac{1}{2}\left(\frac{1 - \frac{1}{2^n}}{1 - \frac{1}{2}}\right) \\ & = n - 1 + \frac{1}{2^n} \end{aligned}\end{equation}\tag{2}\label{eq2}$$
As you can see, this matches the corrected version of your solution attempt.
You can also check a few values to confirm, e.g., $S_1 = \frac{1}{2}$, $S_2 = 1 + \frac{1}{4} = \frac{5}{4} = \frac{1}{2} + \frac{3}{4}$, etc.