<s>[INST] Contour Integration of $\sin^2(x)/(1+x^2)$ How should I calculate this integral 
$$\int\limits_{-\infty}^\infty\frac{\sin^2x}{(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. 
 [/INST] First we simplify the integral the following way using the simple trigonometric identity $\sin^2 x = \frac 12 - \frac 12 \cos{2x}$: $$\begin{align*}\int_{-\infty}^{\infty} \frac{\sin^2 x}{1+x^2}\,dx &= \frac 12 \int_{-\infty}^{\infty} \frac{dx}{1+x^2} - \frac 12 \int_{-\infty}^{\infty} \frac{\cos {2x}}{1+x^2}\,dx\\&= \frac{\pi}{2} - \frac 12 \int_{-\infty}^{\infty} \frac{\cos {2x}}{1+x^2}\,dx\end{align*}$$
Now to solve this second integral we note that it is equivalent to $\int_{-\infty}^{\infty} \frac{e^{2ix}}{1+x^2}\,dx$ as the imaginary part is odd so it's integral evaluates to 0. We now consider the semi circle contour integral of radius $R$ as $R \to \infty$ in the top half plane for this function traveling in an anti-clockwise direction, encompassing the pole at $z = i$.
$$\oint \frac{e^{2iz}}{1+z^2}\,dz = \int_{-R}^{R}\frac{e^{2iz}}{1+z^2}\,dz + \int_{\gamma} \frac{e^{2iz}}{1+z^2}\,dz$$ where $\gamma$ is the semi-circle arc contour. By Cauchy's integral formula we have $$\oint \frac{e^{2iz}}{1+z^2}\,dz = \oint \frac{\frac{e^{2iz}}{z+i}}{z-i}\,dz = 2\pi i \frac{e^{-2}}{2i} = {\pi \over e^2}$$
Now we look at the semi-circle arc contour. $$\lvert z^2 + 1 - 1 \rvert \leq \lvert z^2 + 1 \rvert + 1 \implies \lvert z^2 + 1 \rvert \geq R^2 - 1\\\left\lvert e^{2iz}\right\rvert \leq 1$$
Hence by the estimation lemma:
$$\left\lvert \int_{\gamma} \frac{e^{2iz}}{1+z^2}\,dz \right\rvert \leq \frac{\pi R}{R^2 - 1}$$
Finally, taking the limit as $R \to \infty$ gives us
$$\int_{-\infty}^{\infty} \frac{e^{2ix}}{1+x^2}\,dx = {\pi \over e^2} \\ \implies \int_{-\infty}^{\infty} \frac{\sin^2 x}{1+x^2}\,dx = \frac{\pi}{2} - \frac{\pi}{2e^2}$$ 
</s>