Evaluation of integral $\int_{0}^{\infty}\frac{\sin x}{x\left ( 1+x^2 \right )^2}\,{\rm d}x$

Depict carefully the path of integration: it is a semicircle in the upper half plane with a bulge at $z=0$ and a keyhole around $z=i$. This gives that you have to compute the residues of $f(z)=\frac{e^{iz}}{z(z^2+1)^2}$ at $z=0$ and $z=i$, but to consider only half the residue at $z=0$:

$$\mathcal{J}=\frac{1}{2}\text{Im}\int_{-\infty}^{+\infty}\frac{e^{iz}}{z(z^2+1)^2}\,dz = \frac{1}{2}\text{Im}\left(2\pi i\operatorname{Res}(f(z),z=i)+\pi i\operatorname{Res}(f(z),z=0)\right)$$ so: $$\mathcal{J} = \frac{1}{2}\text{Im}\left(2\pi i\cdot \frac{-3}{4e}+\pi i\right)=\frac{1}{2}\left(\pi-\frac{3\pi}{2e}\right)=\color{red}{\frac{\pi}{2}\left(1-\frac{3}{2e}\right)}.$$


Another way to evaluate this integral is to use Parseval's theorem, which states that for functions $f$ and $g$ with respective Fourier transforms $F$ and $G$, we have

$$\int_{-\infty}^{\infty} dx \, f(x) g^*(x) = \frac1{2 \pi} \int_{-\infty}^{\infty} dk \, F(k) G^*(k) $$

Here $f(x) = \sin{x}/x$ and $g(x) = (1+x^2)^{-2}$. Thus, $F(k) = \pi$ when $k \in [-1.1]$ and $0$ otherwise and $G(k) = (\pi/2) (|k|+1) e^{-|k|}$. The integral is then

$$\frac{\pi}{8} \int_{-1}^1 dk \, (|k|+1) e^{-|k|} = \frac{\pi}{4} \int_0^1 dk (k+1) e^{-k} $$

$$\int_0^1 dk \, e^{-k} = 1-e^{-1}$$ $$\int_0^1 dk \,k \, e^{-k} = -e^{-1}+ \int_0^1 dk \, e^{-k} = 1-2 e^{-1}$$

Therefore, the integral is equal to

$$\frac{\pi}{4} \left (2-\frac{3}{e} \right ) = \frac{\pi}{2} \left (1-\frac{3}{2 e} \right )$$


Another approach: Parameterize the integral as $$I(a)=\int_{0}^{\infty}\frac{\sin ax}{x\left ( 1+x^2 \right )^2}\,{\rm d}x$$ Take the Laplace transform, find your partial fractions, and take the inverse transform: $$\begin{align*}\mathcal{L}_s\{I(a)\}&=\int_0^\infty\int_{0}^{\infty}\frac{\sin ax}{x\left ( 1+x^2 \right )^2}e^{-as}\,{\rm d}a\,{\rm d}x\\ &=\int_0^\infty\frac{\mathcal{L}_s\{\sin ax\}}{x\left ( 1+x^2 \right )^2}\,{\rm d}x\\ &=\int_0^\infty\frac{x}{x\left ( 1+x^2 \right )^2\left(s^2+x^2\right)}\,{\rm d}x\\ &=\int_0^\infty\frac{{\rm d}x}{\left ( 1+x^2 \right )^2\left(s^2+x^2\right)}\\ &=-\frac{1}{(s^2-1)^2}\int_0^\infty\left(\frac{1}{1+x^2}-\frac{s^2-1}{(1+x^2)^2}-\frac{1}{s^2+x^2}\right)\,{\rm d}x\\ &=-\frac{1}{(s^2-1)^2}\left(\frac{\pi}{2}-\frac{\pi(s^2-1)}{4}-\frac{\pi}{2s}\right)\\ &=\frac{\pi}{4}\left(\frac{2}{s}-\frac{2}{s+1}-\frac{1}{(s+1)^2}\right)\\ I(a)&=\frac{\pi}{4}{\mathcal{L}^{-1}}_a\left\{\frac{2}{s}-\frac{2}{s+1}-\frac{1}{(s+1)^2}\right\}\\ &=\frac{\pi}{4}(2+-2e^{-a}-ae^{-a})\end{align*}$$ Finally, since $\mathcal{J}=I(1)$, you have $$\mathcal{J}=\frac{\pi}{2}-\frac{3\pi}{4e}$$