Integration over complex plane I have a problem with the following integral
$$\int_{-\infty}^{\infty}\frac {x\sin x}{x^4+1}$$
Can someone please help me with the way the solution goes? I would highly appreciate it
Thanks in advance!
 A: We first write the integral of interest as 
$$\int_{-\infty}^\infty \frac{x\sin x}{x^4+1}\,dx=\text{Im}\left(\int_{-\infty}^\infty \frac{xe^{ix}}{x^4+1}\,dx\right)\tag 1$$
Next, we analyze the contour integral
$$\oint_C \frac{ze^{iz}}{z^4+1}\,dz=\int_{-R}^R \frac{xe^{ix}}{x^4+1}\,dx+\int_0^\pi \frac{Re^{i\phi}e^{iRe^{i\phi}}}{R^4e^{i4\phi}+1}iRe^{i\phi}\,d\phi \tag 2$$
As $R\to \infty$, the second integral in $(2)$ vanishes while the imaginary part of the first integral becomes the integral on the right-hand side $(1)$.  Therefore, we have
$$\int_{-\infty}^\infty \frac{x\sin x}{x^4+1}\,dx=\text{Im}\left(2\pi i \sum \text{Res}\left(\frac{ze^{iz}}{z^4+1},z=e^{i\pi/4},e^{i3\pi/4}\right)\right)$$
The residues at $z=\frac{\pm1+i}{\sqrt 2}$ are given by
$$\begin{align}
\lim_{z\to \frac{\pm1+i}{\sqrt 2}}\left(\frac{\left(z-\frac{\pm1+i}{\sqrt 2}\right)ze^{iz}}{z^4+1}\right)&=\lim_{z\to \frac{\pm1+i}{\sqrt 2}}\frac{e^{iz}}{4z^2}\\\\
&=\frac{e^{-1/\sqrt 2}e^{\pm i/\sqrt 2}}{\pm i4}
\end{align}$$
The sum of the residues is therefore
$$\frac12 e^{-1/\sqrt 2}\sin\left(1/\sqrt 2\right)$$
Putting it all together yields
$$\bbox[5px,border:2px solid #C0A000]{\int_{-\infty}^\infty \frac{x\sin x}{x^4+1}\,dx=\pi e^{-1/\sqrt 2}\sin\left(1/\sqrt 2\right)}$$
