<s>[INST] Another magic re-write question, picture! It's the part before and after "Thus". 

$$I = \ldots = \int e^{ax} \cos bx \ \mathrm{d}x = \frac{1}{b} e^{ax} \sin bx + \frac{a}{b^{2}} \cos bx - \frac{a^{2}}{b^{2}} I.$$
Thus
$$\left( 1 + \frac{a^{2}}{b^{2}} \right) I = \frac{1}{b} e^{ax} \sin bx + \frac{a}{b^{2}} \cos bx + C_1,$$
and
$$\int e^{ax} \cos bx \ \mathrm{d}x = I = \frac{be^{ax}\sin bx+ae^{ax} \cos bx}{b^2+a^2}+C.$$
Were does the "+1" come from? I thought this was an old "move to other side of equal-sign" until that +1 spawned in my face hehe.  
 [/INST] The integral calculation is done by integration by parts:
\begin{align}
I = \int e^{ax} \cos bx \ dx = \frac{1}{b} e^{ax} \sin bx + \frac{a}{b^{2}} \cos bx - \frac{a^{2}}{b^{2}} I.
\end{align}
Solving for $I$, we have
\begin{align}
I + \frac{a^{2}}{b^{2}} I = \left( 1 + \frac{a^{2}}{b^{2}} \right) I = \frac{1}{b} e^{ax} \sin bx + \frac{a}{b^{2}} \cos bx + C_1,
\end{align} 
(answering your $+1$ question) so 
\begin{align}
I = \left( 1 + \frac{a^2}{b^2} \right)^{-1} \left( \frac{1}{b} e^{ax} \sin bx + \frac{a}{b^{2}} \cos bx \right) + C = \frac{b e^{a x} \sin bx + a e^{ax} \cos bx }{a^{2} + b^{2}} + C
\end{align}
by multiplying by $\frac{b^{2}}{b^{2}}$ and clearing the denominator, and where we have added $C_1$ and $C$ as arbitrary integration constants, related by the factor $(1 + \frac{a^2}{b^2})^{-1}$.
</s>