Contour integration for a ratio of a trig. function and a polynomial We are supposed to use contour integration to determine
$$\int_{-\infty}^\infty f(x)dx=\int_{-\infty}^\infty \frac{\cos(x)dx}{x^2+2x+5}$$
and we are given the (obvious) hint that $\text{Re}(e^{ix})=\cos(x)$. So I re-wrote it as
$$ \text{Re}\left(\int_{-\infty}^\infty \frac{e^{ix}dx}{(x+(1-2i))(x+(1+2i))}\right)$$
however after this I'm a little stumped: there's two singularities in the complex plane at $x=-1\pm2i$. Does that mean that my solution will be something along the lines of
$$2\pi i\left(\text{Res}[f(-1+2i)]+\text{Res}[f(-1-2i)]\right)$$
and if so for the residue formulation does that mean that the number of poles is 2 and therefore 
$$ \text{Res}[f(a)]=\frac{1}{2!}\lim_{x\rightarrow a} \frac{d^2}{dx^2}\left[ (x-a)^{3}f(x)\right].$$
I'm also not sure what the correct answer, so that doesn't really help my attempts. My latest answer was $\pi/2e^2$. Any help is appreciated. Thanks.

Take as contour only half a circle:
$$C_R:=[-R,R]\cup\Gamma_R\;,\;\;\Gamma_R:=\{z\in\Bbb C\;:\; \text{Im}\,z\ge0\}$$
and then you only have one pole inside your contour's region, $\;-1+2i\;$, and the residue there is
$$\lim_{z\to -1+2i} (z+(1-2i))f(z)=\lim_{z\to -1+2i}\frac{e^{iz}}{z+(1+2i))}=\frac{e^{-2}e^i}{4i}$$
And now let $\;R\to\infty\;$ and use the real and imaginary parts of the integral and etc.
