Evaluate $\int \frac{xe^x}{1+x^2}dx$ 
Evaluate $\int \frac{xe^x}{1+x^2}dx$

My attempt: I tried to evaluate the integral by parts considering $\frac{x}{1+x^2}$ as first function and $e^x$ as second function but did not get anything useful.
 A: \begin{align}
\int\frac{x\mathrm{e}^x}{x^2+1}\,\mathrm{d}x&=\int\frac{x\mathrm{e}^x}{\left(x-i\right)\left(x+i\right)}\,\mathrm{d}x \\ & = \int\left(\frac{\mathrm{e}^x}{2\left(x+i\right)}+\dfrac{\mathrm{e}^x}{2\left(x-i\right)}\right)\mathrm{d}x \\ &= \frac{1}{2}\underbrace{\int\frac{\mathrm{e}^x}{x+i}\,\mathrm{d}x}_{\equiv I_1}+\frac{1}{2}\underbrace{\int\frac{\mathrm{e}^x}{x-i}\,\mathrm{d}x}_{\equiv I_2}
\end{align}
To evaluate $I_1$ make $u=x+i$. This change of variable give us
$$I_1=\mathrm{e}^{-i}\int\frac{\mathrm{e}^u}{u}\,\mathrm{d}u=\mathrm{e}^{-i}\operatorname{Ei}\left(x+i\right),$$
since 
$$ \int\frac{\mathrm{e}^u}{u}\,\mathrm{d}u=\operatorname{Ei}\left(u\right), $$
where $\operatorname{Ei}$ is the Exponential integral. A similar approach with $u=x-i$ gives
$$I_2=\mathrm{e}^{i}\int\frac{\mathrm{e}^u}{u}\,\mathrm{d}u=\mathrm{e}^{i}\operatorname{Ei}\left(x-i\right).$$
Thereby,
$$ \int\frac{x\mathrm{e}^x}{x^2+1}=\frac{\mathrm{e}^{-i}\operatorname{Ei}\left(x+i\right)+\mathrm{e}^i\operatorname{Ei}\left(x-i\right)}{2}+C.$$
