Integration by transforming to complex Evaluate the following by transforming it into a complex integral:
$$\int_{-\infty}^{\infty} \frac{\cos 4x}{x^4+5x^2+4}dx.$$
Could someone show me where to start?  This is not homework, it's a study question for an exam and my professor didn't post the solution
 A: Let's get you started.
Your integral is equal to the real part of the integral 
$$\int_{-\infty}^{\infty} \frac{e^{4ix}}{x^4+5x^2+4}dx.$$
This integral appears (sort of) in the following (surprisingly easier-to-play-with) equation:
$$\int_L \frac{e^{4iz}}{z^4+5z^2+4}dz=\lim\limits_{R\to\infty}\left(\int_{-R}^{R} \frac{e^{4iz}}{z^4+5z^2+4}dz+\int_{C_R} \frac{e^{4iz}}{z^4+5z^2+4}dz\right),$$
where $L$ is the curve consisting of the real line and the positively-oriented half-circle in the upper-half plane, $C_\infty$. Note that along the real axis, $z=x$.
The integrand has four simple poles, at $z=\pm i$ and at $z=\pm 2i$. Both positive poles are in your contour. For the left side of the equation, find their residues from the Residue Theorem. Then for the right side, show that the integral over $C_R$ goes to $0$ in the limit (at least, it should...). Then take the real part of both sides, and you will be left with your result.
EDIT: Between this and the wonderful picture provided by David G. Stork, you should be well on your way.
A: A comment (so don't downvote) for @TheCount.
When in doubt, draw a picture (worth 1000 words):

And for completeness, the answer is:
$$\frac{(2 e^4 -1)\pi}{6 e^8}$$
