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.

First notice that for any $m$, $\sum_{i=0}^{m-1} 2^i = 2^m-1$. To see this
(and really this is the geometric series proof applied to your situation), let $$S=\sum_{i=0}^{m-1} 2^i=1+2+4+8+\cdots+2^{m-1}.$$ Then \begin{eqnarray*} 2S&=&2+4+8+\cdots+2^{m-1}+2^m\\ &=& (-1+1)+2+4+\cdots+2^{m-1}+2^m\\&=& -1+(1+2+4+\cdots+2^{m-1})+2^m\\ &=& -1 + S + 2^m.\end{eqnarray*}
So $2S=-1+S+2^m$ and so $S=2^m-1$.
Now your sum is $$\sum_{i=0}^{n-2} 2^{-i+n-2} + 2^i = \sum_{i=0}^{n-2} 2^{(n-2)-i} + \sum_{i=0}^{n-2} 2^i.$$
But $$\sum_{i=0}^{n-2} 2^{(n-2)-i} = \sum_{i=0}^{n-2} 2^i.$$ Here, the left-side is the sum $2^{n-2}+2^{n-3}+\cdots + 2+1$ and the right-side just expresses this sum in the reverse order $1+2+\cdots+2^{n-3}+2^{n-2}$.
So putting this together you have \begin{eqnarray*} \sum_{i=0}^{n-2} 2^{-i+n-2} + 2^i &=& \sum_{i=0}^{n-2} 2^{(n-2)-i} + \sum_{i=0}^{n-2} 2^i\\ &=& \sum_{i=0}^{n-2} 2^{i} + \sum_{i=0}^{n-2} 2^i\\ &=&2\sum_{i=0}^{n-2} 2^i \\ &=& 2(2^{n-1}-1) \\ &=& 2^{n}-2\end{eqnarray*}
