I am meant to use the residue theorem to show that
$\int\limits_{-\infty}^\infty \frac{\cos t}{(t^2+1)^2}dt=\frac{\pi}{e}$.
So far I have deduced that I should take a contour over $\alpha$ the path from $-r$ to $r$ along with the semi-circle connecting $-r$ to $r$. Then I should take the limit as $r$ goes to infinity, show that the integral along the semicircle portion vanishes, and thus, by the residue theorem and the fact that the integrand has a simple pole at $i$, the improper integral is equal to $2\pi i$ times the residue of the integrand at $i$. Can someone tell me if I am approaching this correctly and possibly explain some of the details because I am having trouble.
Try the complex function $\;f(z)=\frac{e^{iz}}{(x^2+1)^2}\;$ on the path
$$C_R=[-R,R]\cup\Gamma_R\;,\;\;\Gamma_R:=\{Re^{it}\in\Bbb C\;;\;0<t<\pi\}\;,\;\;R\in\Bbb R^+$$
It has a single double pole within the domain enclosed by this path, namely at $\;z=i\;$, and we get$${}$$
$$\text{res}(f)_{z=i}=\frac d{dz}\left((z-i)^2f(z)\right)_{z=i}=\left.\frac d{dz}\left(\frac{e^{iz}}{(z+i)^2}\right)\right|_{z=i}=\left.\frac{ie^{iz}(z+i)-2e^{iz}}{(z+i)^3}\right|_{z=i}=$$
$$=\frac{-2e^{-1}-2e^{-1}}{-8i}=-\frac{i}{2e}$$
and then$${}$$
$$-\frac{2\pi i\cdot i}{2e}=\frac\pi e=\oint_{C_r}f(z)\,dz=\int_{-R}^R\frac{e^{ix}}{(x^2+1)^2}dx+\int_{\Gamma_R}f(z)\,dz$$
Yet
$$\left|\int_{\Gamma_R}f(z)dz\right|\le\ell(\Gamma_R)\cdot\max_{z\in\Gamma_R}|f(z)|=\frac{\pi R^2}{\min\left|\left(R^2e^{2it}+1\right|\right)^2}\le\frac{\pi R^2}{R^4}\xrightarrow[R\to\infty]{}0$$
So$${}$$
$$\frac\pi e=\lim_{R\to\infty}\oint_{C_R}f(z)\,dz=\int_{-\infty}^\infty\frac{\cos x+i\sin x}{(x^2+1)^2}dx$$
and comparing real parts you get your result.