Contour integration using Cauchy's integral formula I need to show that 
$$\int_{-\infty}^\infty\frac{\sin^2(x)}{x^2+1}dx=\frac{\pi}{2}\left(1-\frac{1}{e^2}\right)$$
but I don't really know why I'm not getting the result using contour integration (I'm not supposed to use the residue theorem). 
Can't I use Cauchy's integral formula this way:
$$\int_{\gamma_r} \dfrac{\frac{\sin^2(z)}{z+i}}{z-i}dz =2\pi i\frac{\sin^2(i)}{2i}$$
along boundary of the upper semicircle of radius r? The other path would be 0 (the boundary without the path along the real axis). What's the problem with this approach?
 A: Write
$$\sin^2{x} = \frac{1}{2} (1-\cos{2 x})$$
Then the above integral is equal to
$$\frac{1}{2} \int_{-\infty}^{\infty} \frac{dx}{1+x^2} - \frac{1}{2} \int_{-\infty}^{\infty} dx\frac{\cos{2 x}}{1+x^2} = \frac{\pi}{2} -  \frac{1}{2} \int_{-\infty}^{\infty} dx\frac{\cos{2 x}}{1+x^2}$$
Consider 
$$\oint_C dz \frac{e^{i 2 z}}{1+z^2}$$
where $C$ is a semicircle in the upper half-plane of radius $R$.  By the residue theorem, this integral is equal to $i 2 \pi$ time the sum of the residues of the poles inside $C$.  In this case, the only pole inside $C$ is at $z=i$, at which the residue is $e^{-2}/(2 i)$.  
Meanwhile, the contour integral vanishes along the semicircular contour in the limit as $R \rightarrow \infty$ (why?), so we are left with the integral along the real line:
$$\int_{-\infty}^{\infty} dx\frac{e^{i 2 x}}{1+x^2} = \int_{-\infty}^{\infty} dx\frac{\cos{2 x}}{1+x^2} = i 2 \pi \frac{e^{-2}}{2 i} = \frac{\pi}{e^2}$$
The result follows.
A: the poles of $ x^{2}+1 $ are $ i $ and $-i $ expand the sine function and apply residue theorem to
$$ \int_{-\infty}^{\infty}dx \frac{e^{2ix}}{x^{2}+1} $$
remmeber $ sin^{2}(x)= \frac{e^{2ix}+e^{-2ix}-2}{-4} $ and $ \int_{-\infty}^{\infty}dx \frac{1}{x^{2}+1}= \frac{\pi}{2} $
