$$I=\int_{-\infty}^{\infty}{\sin^2{x}\over 1+x^2}dx=2\pi-{\pi^2\over 2}$$
Apply residue theorem
$$f(x)={\sin^2{x}\over 1+x^2}$$
$$\sin^2{x}={1-\cos(2x)\over 2}$$
$$I={1\over 2}\int_{-\infty}^{\infty}{1\over 1+x^2}dx-{1\over 2}\int_{-\infty}^{\infty}{\cos(2x)\over 1+x^2}dx$$
Applying residue theorem
$$(x^2+1)=(x+i)(x-i)$$
$$2\pi{i}Res(f(x),i)=2\pi{i}\lim_{x\to i}={\cos(2i)\over 2i}=\pi\cosh{2}$$
$$I={\pi\over 2}-{\pi\over 2}\cosh{2}$$
What seem to be the problem here?
The problem is that $\cos(2z)$ does not approach zero as $|z|\to \infty$.
Instead, write $\cos(2x)=\text{Re}(e^{ix})$. Then, we have
$$\lim_{R\to \infty}\int_0^\pi \frac{e^{i2Re^{i\phi}}}{R^2e^{i2\phi}+1}\,iRe^{i\phi}\,d\phi=0$$
and
$$\int_{-\infty}^\infty \frac{e^{i2x}}{x^2+1}\,dx=2\pi i \,\text{Res}\left(\frac{e^{i2z}}{z^2+1}, z= i\right)=2\pi i \frac{e^{-2}}{2i}=\pi/e^2$$