How would one evaluate $\int\frac{x\sin(x)}{x^2+1}$ over the real line?
Define
$$f(z)=\frac{ze^{iz}}{z^2+1}\;,\;\;C_R:=\{z=Re^{it}\in\Bbb C\;;\;R,t\in\Bbb R\;,\;0\le t\le \pi\}\;,\;$$
$$\gamma_r:=[-R,R]\cup C_R\;,\;\;\text{positively oriented}$$
For $\;R>1\;$ , our function has one unique simple pole at $\;z=i\;$ within $\;\gamma_R\;$ , with residue
$$\text{Res}_{z=i}(f)=\lim_{z\to i}\;(z-i)f(z)=\frac{ie^{-1}}{2i}=\frac1{2e}$$
So by Cauchy's Theorems
$$\frac{2\pi i}{2e}=\frac{\pi i}e=\oint\limits_{\gamma_R}f(z)dz=\int\limits_{-R}^R\frac{xe^{ix}}{x^2+1}dx+\int\limits_{C_R}f(z)dz$$
But by Jordan's Lemma
$$\left|\;\int\limits_{\gamma_R} f(z)dz\;\right|\xrightarrow [R\to\infty]{}0\;$$
So we get
$$\frac{\pi i}e=\int\limits_{-\infty}^\infty\frac{x(\cos x+i\sin x)}{x^2+1}dx$$
Take now just the imaginary parts in both sides to get the result.