TITLE: Contour Integration of $\sin(x)/(x+x^3)$
QUESTION [5 upvotes]: How should I calculate this integral 
$$\int\limits_{-\infty}^\infty\frac{\sin x}{x(1+x^2)}\,dx\quad?$$ 
I have tried forming an indented semicircle in the upper half complex plane using the residue theorem and I tried to integrate along a curve that went around the complex plane and circled the positive real axis (since the integrand is even). Nothing has worked out for me. Please help!

REPLY [3 votes]: Defining
$$\gamma_M:=\{z\in\Bbb C\;;\;z=Me^{it}\;,\;0\le t\le\pi\}\;,\;\;M\in (0,\infty),$$
and
$$f(z):=\frac{e^{iz}}{z(z^2+1)}\;,\;\;C_R:=[-R,-\epsilon]\cup\gamma_\epsilon\cup[\epsilon,R]\cup\gamma_R\;,\;\;0<\epsilon<<R$$ 
We get that, as the only pole of $\,f\,$ within the region limited by $\,C_R\,$ is $\,z=i\,$ , that
$$\oint\limits_{C_R}f(z)\,dz=2\pi i\,Res_{z=i}(f)$$
Now:
$$Res_{z=i}(f)=\lim_{z\to i}(z-i)f(z)=\frac{e^{i^2}}{i(2i)}=-\frac{e^{-1}}{2}$$
$$Res_{z=0}(f)=\lim_{z\to 0}zf(z)=\frac{e^0}{1}=1$$
So, using the corollary to the lemma in the first answer here, and taking into account that we integrate on the negative direction on $\,\gamma_\epsilon\,$ , we get:
$$\frac{\pi i}{e}=\int\limits_{C_R}f(z)\,dz=\int\limits_{-R}^{-\epsilon}f(x)dx+\int\limits_{\gamma_\epsilon}f(z)\,dz+\int\limits_\epsilon^Rf(x)\,dz+\int\limits_{\gamma_R}f(z)\,dz\xrightarrow[\stackrel{\epsilon\to\ 0}{R\to\infty}]{}$$
$$\xrightarrow[\stackrel{\epsilon\to\ 0}{R\to\infty}]{}\int\limits_{-\infty}^\infty f(x)\,dx-\pi i\Longrightarrow$$
$$\int\limits_{-\infty}^\infty\frac{e^{ix}}{x(x^2+1)}dx=\pi i\left(1-\frac{1}{e}\right)\iff$$
and comparing real and imaginary parts in both sides we get
$$\int\limits_{-\infty}^\infty\frac{\sin x}{x(x^2+1)}dx=\pi\frac{e-1}{e}$$
Note: You can either use Jordan's Lemma or directly evaluate by Cauchy's to get
$$\int\limits_{C_R}f(z)\,dz\xrightarrow[R\to\infty]{}0$$

REPLY [2 votes]: $$
\begin{align}
\int_{-\infty}^\infty\frac{\sin(x)}{x(1+x^2)}\,\mathrm{d}x
&=\mathrm{Im}\left(\int_{-\infty}^\infty\frac{e^{ix}}{x(1+x^2)}\,\mathrm{d}x\right)\\
&=\mathrm{Im}\left(\int_\gamma\frac{e^{iz}}{z(1+z^2)}\,\mathrm{d}z\right)\\
\end{align}
$$
where $\gamma$ goes from $(1/R,0)$ to $(R,0)$ circles counterclockwise from $(R,0)$ to $(-R,0)$ from $(-R,0)$ to $(-1/R,0)$, then circles clockwise from $(-1/R,0)$ to $(1/R,0)$.
The integral on the flat pieces gives the integral you are looking for.
We use the contour through the upper half-plane since the integrand vanishes quickly there. That is, the integral along the large half-circle is $0$.
The residue at $z=0$ is $1$ so the integral along the small half-circle is $-\pi i$.
The residue at $z=i$ is $\frac{e^{-1}}{i(i+i)}=-\frac1{2e}$, Thus, the integral along the entire contour is $-\frac{\pi i}{e}$.
Thus, the integral along the two flat pieces is $\pi i-\frac{\pi i}{e}$. Therefore,
$$
\int_{-\infty}^\infty\frac{\sin(x)}{x(1+x^2)}\,\mathrm{d}x=\pi\frac{e-1}{e}
$$