Integrate $\int_0^\infty \frac{\sin x}{x(1+x^2)^2} dx$ with contour integral How to integrate $$I=\int_0^\infty \frac{\sin x}{x(1+x^2)^2}dx$$ using contour integration?
Since, it is even,
$$I=0.5*\int_{-\infty}^{\infty}\frac{\sin x}{x(1+x^2)^2}dx$$
$$I=-0.25i(\int_{-\infty}^{\infty}\frac{e^{ix}}{{x(1+x^2)^2}}dx-\int_{-\infty}^{\infty}\frac{e^{-ix}}{{x(1+x^2)^2}}dx)$$
For second term,
$x \rightarrow -x$
$$\implies I=-0.25i(\int_{-\infty}^{\infty}\frac{e^{ix}}{{x(1+x^2)^2}}dx+\int_{-\infty}^{\infty}\frac{e^{ix}}{{x(1+x^2)^2}}dx)$$
$$\implies I=-0.5i\int_{-\infty}^{\infty}\frac{e^{ix}}{{x(1+x^2)^2}}dx$$
$$I=\frac{1}{2i}\int_{-\infty}^{\infty}\frac{e^{ix}}{x(1+x^2)^2}dx$$
$$I=\frac{1}{2i}(\int_{-\infty}^{\infty}\frac{e^{ix}}{x}dx-\int_{-\infty}^{\infty}\frac{xe^{ix}}{1+x^2}dx-\int_{-\infty}^{\infty}\frac{xe^{ix}}{(1+x^2)^2}dx)$$
$$I=\frac{1}{2i}(-\pi i)-\frac{1}{2i}*2\pi i*\frac{ie^{-1}}{2i}-\frac{1}{2i}*2\pi i*\frac{e^{-1}}{4}$$
$$I=\frac{-\pi }{2}-\frac{\pi e^{-1}}{2}-\frac{\pi e^{-1}}{4}$$
$$I=-\frac{\pi}{2}(1+\frac{3e^{-1}}{2})$$
But, the answer is $\frac{\pi}{2}(1-\frac{3}{2e})$. Where am I committing a mistake?
 A: We can evaluate the integral of interest by writing ($\varepsilon>0$ and $R>1$)
$$\begin{align}
\oint_{C}\frac{e^{iz}}{z(1+z^2)^2}\,dz&=\int_{-R}^{-\epsilon}\frac{e^{ix}}{x(1+x^2)^2}\,dx+\int_\pi^0 \frac{e^{i\varepsilon e^{i\phi}}}{\varepsilon e^{i\phi}\left(1+\varepsilon^2 e^{i2\phi}\right)^2}\,i\varepsilon e^{i\phi}\,d\phi\\\\
& +\int_{\varepsilon}^R \frac{e^{ix}}{x(1+x^2)^2}\,dx+\int_0^\pi \frac{e^{iR e^{i\phi}}}{R e^{i\phi}\left(1+R^2 e^{i2\phi}\right)^2}\,iR e^{i\phi}\,d\phi
\end{align}$$
Let $R\to \infty$, $\varepsilon\to0$, take the imaginary part, and set the integral equal to $i2\pi$ times the the residue of $\frac{e^{iz}}{z(1+z^2)^2}$ at $z= i$ (This remedies the second issue.) to find the result.
Can you finish?

If one wishes to proceed using partial fraction expansion, then I would suggest the following.  First, we use partial fraction expansion to write the integral $I=\int_0^\infty \frac{\sin(x)}{x(1+x^2)^2}\,dx$ as
$$\begin{align}
I&=\frac12\int_{-\infty}^\infty \frac{\sin(x)}{x(1+x^2)^2}\,dx\\\\
&=\frac12\int_{-\infty}^\infty \left(\frac{\sin(x)}{x}-\frac{x\sin(x)}{1+x^2}-\frac{x\sin(x)}{(1+x^2)^2}\right)\,dx\tag1
\end{align}$$
Then, we can evaluate each of the three integral on the right-hand side of $(1)$ using contour integration.
Using the residue theorem, we have
$$\begin{align}
0&=\oint_{C}\frac{e^{iz}}{z}\,dz\\\\
&=\int_{-R}^\varepsilon \frac{e^{ix}}{x}\,dx+\int_\pi^0 \frac{e^{i\varepsilon e^{i\phi}}}{\varepsilon e^{i\phi}}\,i\varepsilon e^{i\phi}\,d\phi\\\\
&+\int_\varepsilon^R \frac{e^{ix}}{x}\,dx+\int_\pi^0 \frac{e^{i R e^{i\phi}}}{R e^{i\phi}}\,iR e^{i\phi}\,d\phi\tag 2
\end{align}$$
Letting $R\to \infty$, $\varepsilon\to0$, and taking the imaginary part of $(2)$, we find that 
$$\int_{-\infty}^\infty \frac{\sin(x)}{x}\,dx=\pi\tag3$$
Next, we write
$$\begin{align}
2\pi i \left(\frac{ie^{-1}}{i2}\right)&=\oint_{C}\frac{ze^{iz}}{1+z^2}\,dz\\\\
&=\int_{-R}^R \frac{xe^{ix}}{1+x^2}\,dx+\int_0^\pi \frac{R e^{i\phi} e^{i R e^{i\phi}}}{1+R^2 e^{i2\phi}}\,iR e^{i\phi}\,d\phi\tag 4
\end{align}$$
Letting $R\to \infty$ and taking the imaginary part of $(4)$ reveals
$$\int_{-\infty}^\infty \frac{x\sin(x)}{1+x^2}\,dx=\frac{\pi}{e}\tag5$$
Similarly, we find that 
$$\int_{-\infty}^\infty \frac{x\sin(x)}{(1+x^2)^2}\,dx=\frac{\pi}{2e}\tag6$$
Using $(3)$, $(5)$, and $(6)$ in $(1)$ yields that coveted result
$$\int_0^\infty \frac{\sin(x)}{x(1+x^2)^2}\,dx=\frac\pi2 \left(1-\frac3{2e}\right)$$
A: In order to you use contour integral you can use residues.
In fact let's set : $f(z) \triangleq \dfrac{e^{izt}}{z(z^2+1)^2}$
So the singularities of $f$ are $0$, $-i$ , $i$ . Let's make around $i$. Take a contour $C$ such $i$ is included in (hemi circle $C_1$ is the small one with radius $r$, and quarter circle $C_2$ is the big one with radius  $R-r$) up the hemi circle in sort of elevating it from the absciss from more than $1$ unit.
$$  \int_C f(z) = \sum_p 2\pi*ires(f,p)$$
So $$ \int_C f(z) = \int_r^R f(z) dz + \int_{-r}^{-R}{f(z)}dz + \int_{C1} f(z) dz + \int_{C2} f(z) dz = res(f,i)
 $$
Quarter circle contour
Then make tend $r$ and $R$ respectly to their values $ 0 $ infinity.
A: This is an extended comment which shows how to cirvcumvent the main difficulty in attacking the integral directly by contour integration as in this answer https://math.stackexchange.com/a/3596146/198592.  It is a kind of "wrapping" which renders the singularity innocent.
The integral to be solved is
$$i = \int_{-\infty}^{\infty}\frac{\sin (x)}{x} \frac{1}{\left(x^2+1\right)^2}\,dx\tag{1}$$
The trick is to write
$$\frac{\sin (x)}{x}=\frac{1}{2} \int_{-1 }^{1 } \exp (-i t x) \, dt\tag{2}$$
Inserting this and doing the $x$-integration (by straightforward contour integration, possibly taking into account the remarks in the discussion) gives
$$\int_{-\infty }^{\infty } \frac{\exp (-i t x)}{\left(x^2+1\right)^2} \, dx=\frac{1}{2} \pi  e^{-\left| t\right| } (\left| t\right| +1)\tag{3}$$
so that from the sub sequenty $t$-integral we get finally
$$i = \frac{\pi}{4}\int_{-1}^{1 }  e^{-\left| t\right| } (\left| t\right| +1)  \, dt
\\=\frac{\pi}{2}\int_{0}^1 e^{-t } ( t +1) \, dt
\\=\pi  \left(1-\frac{3}{2 e}\right)\simeq 1.4080016313205$$
Discussion
The calculation of the integral $(3)$ can be simplified observing that
$$ \frac{1}{\left(x^2+1\right)^2}=-\frac{1}{2}\frac{d}{da}\frac{1}{\left(x^2+a^2\right)}|_{a\to 1}$$
so that it is sufficient to calculate
$$\int_{-\infty }^{\infty } \frac{\exp (-i t x)}{\left(x^2+a^2\right)} \, dx$$
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
I & =
\int_{0}^{\infty}{\sin\pars{x} \over x\pars{1 + x^{2}}^{2}}\,\dd x =
{1 \over 2}\,\Im\int_{-\infty}^{\infty}{\expo{\ic x} - 1 \over
x\pars{x - \ic}^{2}\pars{x + \ic}^{2}}\,\dd x
\\[5mm] & =
{1 \over 2}\,\Im\braces{2\pi\ic \lim_{\large x\ \to\ \ic}\,
\totald{}{x}\bracks{\expo{\ic x} - 1 \over x\pars{x + \ic}^{2}}}
\\[5mm] & =
\pi\,\Re\braces{\lim_{\large x\ \to\ \ic}\,
\bracks{\ic\expo{\ic x}\pars{x^{2} + 4\ic x - 1} + 3x + \ic \over
x^{2}\pars{x + \ic}^{3}}}
\\[5mm] & =
\bbx{\pi\pars{{1 \over 2} - {3 \over 4\expo{}}}}\
\approx\ 0.7040
\end{align}
