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.
The thing you've asked to show isn't too hard: \begin{align} \sum_{i=0}^{n-2} \left(2^{-i+n-2} + 2^i\right) &= \sum_{i=0}^{n-2} \left(2^{-i+n-2}\right) + \sum_{i=0}^{n-2}\left(2^i\right) \\ &= \sum_{i=0}^{n-2} \left(2^{-i+n-2}\right) + \left(1 + 2 + \ldots + 2^{n-2}\right) \\ &= \sum_{i=0}^{n-2} \left(2^{-i+n-2}\right) + \left(2^{n-1} - 1\right) \\ \end{align} where that last thing comes form the formula for the sum of a geomtric series, which I think you probably know. Now let's simplify the left-hand term...
\begin{align} \sum_{i=0}^{n-2} \left(2^{-i+n-2} + 2^i\right) &= \sum_{i=0}^{n-2} \left(2^{-i+n-2}\right) + \left(2^{n-1} - 1\right) \\ &= \sum_{i=0}^{n-2} \left(2^{(n -2)-i)}\right) + \left(2^{n-1} - 1\right) \\ &= \left(2^{n -2} + 2^{n-3} + \ldots + 2^0\right) + \left(2^{n-1} - 1\right) \\ \end{align} which we recognize as another geometric series, written in reverse order; the sum there gives us \begin{align} \sum_{i=0}^{n-2} \left(2^{-i+n-2} + 2^i\right) &= \left(2^{n -2} + 2^{n-3} + \ldots + 2^0\right) + \left(2^{n-1} - 1\right) \\ &= \left(2^{n -1} - 1\right) + \left(2^{n-1} - 1\right) \\ &= 2 \cdot 2^{n -1} - 2 \\ &= 2^{n} - 2. \end{align}
Quick proof for the geometric series: If we expand $$ U = (1 - a) (1 + a + a^2 + \ldots a^k) $$ with the distributive law, and then gather like terms via the commutative law for addition, we get this: \begin{align} U &= (1 - a) (1 + a + a^2 + \ldots + a^{k-1} + a^k)\\ &= 1 \cdot (1 + a + a^2 + a^{k-1} + \ldots a^k) - a \cdot (1 + a + a^2 + \ldots + a^{k-1} + a^k)\\ &= (1 + a + a^2 + \ldots + a^{k-1} + a^k) - (a + a^2 + a^3 + \ldots + a^k + a^{k+1})\\ &= 1 + (a + a^2 + \ldots a^k) - (a + a^2 + a^3 + \ldots + a^k) - a^{k+1})\\ &= 1 - a^{k+1}) \end{align} so we have that $$ 1-a^{k+1} = (1-a) (1 + a + \ldots + a^k) $$ hence (for $a \ne 1$), $$ 1 + a + \ldots + a^k = \frac{1-a^{k+1}}{1-a}, $$ which is the formula for the sum of a finite geometric series whose ratio is not 1. For an infinite series whose ratio has absolute value less than 1, the infinite sum turns out to be $\frac{1}{1-a}$, by the way, but this requires a careful definition of a sum for an infinite series.