The recurrence can be solved using generating functions. We have the recurrence:
$$ a_n = 2 a_{n - 1} - 2^n $$
Summing all $a_n$ and converting to power series we get, according to the recurrence relation:
$$ \sum_{n = 1}^{\infty} a_n x^n = 2 \sum_{n = 0}^{\infty} a_n x^{n + 1} - \sum_{n = 1}^{\infty} 2^n x^n$$
$$ \sum_{n = 1}^{\infty} a_n x^n = 2 x \sum_{n = 0}^{\infty} a_n x^n - \sum_{n = 1}^{\infty} 2^n x^n$$
We now define $A(x) = \sum_{n = 0}^{\infty} a_n x^n$. Plugging into above we get:
$$ A(x) - a_0 = 2x A(x) - \sum_{n = 1}^{\infty} 2^n x^n$$
Now using the fact that $x$ is arbitrary and we are only interested in the coefficients of the series, which are the elements of the recurrence relation, we may choose $x$ such that $\sum_{n = 1}^{\infty} 2^n x^n$ converges, getting:
$$ A(x) - a_0 = 2x A(x) - \left( \frac{1}{1 - 2x} - 1 \right) $$
Rearranging we get:
$$ A(x) = \frac{a_0 - 2a_0 x - 2x}{\left( 1 - 2x \right)^2} = \frac{5 - 12x}{\left( 1 - 2x \right)^2} $$
Applying partial fraction decomposition to the above gives us:
$$ A(x) = \frac{6}{1 - 2x} - \frac{1}{\left(1 - 2x \right)^2}$$
Now we need to convert above to a power series to obtain the coefficients which are the elements of the recurrence. We have that:
$$ \frac{1}{1 - 2x} = \sum_{n = 0}^{\infty} 2^n x^n $$
Therefore:
$$ A(x) = 6\sum_{n = 0}^{\infty} 2^n x^n - \frac{1}{\left(1 - 2x \right)^2}$$
We can deduce the series for $\frac{1}{\left(1 - 2x \right)^2}$ by differentiating $\frac{1}{1 - 2x}$:
$$ \frac{2}{\left( 1 - 2x \right)^2} = \frac{d}{dx} \frac{1}{1 - 2x} = \sum_{n = 1}^{\infty} 2^n \cdot n x^{n - 1}$$
From which we conclude that:
$$ A(x) = 6\sum_{n = 0}^{\infty} 2^n x^n - \sum_{n = 1}^{\infty} 2^{n - 1} \cdot n x^{n - 1}$$
Or:
$$ A(x) = 6\sum_{n = 0}^{\infty} 2^n x^n - \sum_{n = 0}^{\infty} (n + 1) 2^n x^n$$
$$ A(x) = \sum_{n = 0}^{\infty} (5 - n) 2^n x^n $$
Which means $a_n = (5 - n)2^n$.