Simplifying sum equation. (Solving max integer encoded by n bits) Probably a lack of understanding of basic algebra. I can't get my head around why this sum to N equation simplifies to this much simpler form.
$$
\sum_{i=0}^{n-2} 2^{-i+n-2} + 2^i  = 2^n - 2
$$
Background
To give you some background I am trying to derive $MaxInt(n) = 2^n-1$ which describes that the maximum integer which can be created using the two's complement where $n$ is the number of bits the integer is encoded by.
How two's complement encodes numbers with 4 bits is explained by the images below:


Therefore:
$$
MaxInt(n) = \sum_{i=0}^{n-2} 2^i = (2^0 + 2^1 + ... + 2^{n-3} + 2^{n-2} )
$$
Maybe there is a way of integrating this or simplifying it but I figured that this is a similar problem to sum to N where
$$
\frac{T(n) + T(n)}{2} = T(n) = \sum_{i=1}^{n} n-i+1 = \sum_{i=1}^{n} i 
$$
So following this logic $MaxInt(n)$ is also equal to:
$$
MaxInt(n) = \frac{MaxInt(n) + MaxInt(n)}{2} 
$$
Since
$$
(2^0 + 2^1 + ... + 2^{n-3} + 2^{n-2}) = (2^{n-2} + 2^{n-3} + ... 2^2 + 2^1 + 2^0)
$$
Then
$$
MaxInt(n) = \sum_{i=0}^{n-2} 2^{n-2-i} = (2^{n-2} + 2^{n-3} + ... 2^2 + 2^1 + 2^0)
$$
Putting it all together:
$$
MaxInt(n) = \frac{\sum_{i=0}^{n-2} 2^{n-2-i} + \sum_{i=0}^{n-2} 2^i}{2}
$$
$$
MaxInt(n) = \frac{\sum_{i=0}^{n-2} 2^{-i+n-2} + 2^i}{2}
$$
Which is when I got stuck, cheating with wolfrom alpha I found that
$$
\sum_{i=0}^{n-2} 2^{-i+n-2} + 2^i  = 2^n - 2
$$
But I don't know why. If you see a better alternative way (i.e. not using sum to N method) of deriving $MaxInt(n) = 2^n-1$ please let me know.
Thanks for reading.

Applying the proof of the geometric series to this particular case:
$$
MaxInt(n) = S(n) = \sum_{i=0}^{n-2} 2^i = 2^0 + 2^1 ... + 2^{n-3} + 2^{n-2}
$$
Adding up each term in the series:
$$
2S(n) = (2^0 + 2^0) + (2^1 + 2^1) ... + (2^{n-3} + 2^{n-3}) + (2^{n-2} + 2^{n-2})
$$
Simplifying:
$$
2S(n) = 2^1 + 2^2 ... + (2 \cdot \frac{2^{n}}{2^3}) + (2 \cdot \frac{2^{n}}{2^2})
$$
$$
2S(n) = 2^1 + 2^2 ... + \frac{2^{n}}{2^2} + \frac{2^{n}}{2^1}
$$
$$
2S(n) = {\color{Blue} {2^1 + 2^2 ... + 2^{n-2}} } + 2^{n-1}
$$
Notice what is in blue is actually $S(n)$ except it is missing the first term, lets call this part in blue $y$:
$$
2S(n) = {\color{Blue} {y} } + 2^{n-1}
$$
$$
{\color{Blue} {y} } = S(n) - 2^0
$$
Substituting in:
$$
2S(n) = {\color{Blue} {S(n) -2^0} } + 2^{n-1}
$$
$$
S(n) = 2^{n-1} - 2^0
$$
$$
= 2^{n-1} - 1
$$
$$
\therefore MaxInt(n) = \sum_{i=0}^{n-2} 2^i = 2^{n-1} - 1
$$
The above is the equation desired by the background question, but the original question asks for $2S(n)$
$$
2S(n) = 2 \sum_{i=0}^{n-2} 2^i 
$$
$$
=  2^1 \cdot (2^{n-1} -  1 ) 
$$
$$
= 2^{n-1+1} - 2 
$$
$$
= 2^{n} - 2
$$
