Taking this from https://en.wikipedia.org/wiki/Integration_using_Euler%27s_formula problem 3 Understanding Euler's formula I still don't understand how:
"cos x is the real part of e^(i x)"
and how the "Real part" affects the function
Thus:
\begin{aligned}\int e^{x}\cos x\,dx&=\operatorname {Re} \left({\frac {e^{(1+i)x}}{1+i}}\right)+C\\[6pt]&=e^{x}\operatorname {Re} \left({\frac {e^{ix}}{1+i}}\right)+C\\[6pt]&=e^{x}\operatorname {Re} \left({\frac {e^{ix}(1-i)}{2}}\right)+C\\[6pt]&=e^{x}{\frac {\cos x+\sin x}{2}}+C.\end{aligned}
$$\int e^xe^{ix}\;dx = \int e^x(\cos(x) + i\sin(x))\;dx = \int e^x\cos(x)\;dx + i\int e^x\sin(x)\;dx $$ The second term is clearly imaginary, so $$\text{Re}\left(\int e^xe^{ix}\; dx\right) = \int e^x\cos(x)\;dx$$ The integral $\int e^xe^{ix}\;dx$ is equal to $\frac{e^{(1+i)x}}{i+1}$, and you know the rest...