TITLE: How do I approach the following integral?
QUESTION [6 upvotes]: Evaluate 
$$\displaystyle \int_{-\infty}^{\infty} \frac{\cos x}{x^2+1}~dx$$

REPLY [5 votes]: Since the simplest route has already been taken, I'll take another. The function $x\mapsto e^{-|x|}$ is integrable on $\mathbb{R}$, and it's Fourier transform is easily computed as
$$
\begin{align}
\int_{-\infty}^\infty e^{-|x|}e^{-itx}\,dx& = \int_0^\infty e^{-x(1+it)}\,dx + \int_{-\infty}^0 e^{x(1-it)}\,dx \\
& = \frac{1}{1+it} + \frac{1}{1-it} \\
& = \frac{2}{1+t^2}
\end{align}
$$
This Fourier transform is integrable. So by the Fourier inversion formula,
$$
\int_{-\infty}^\infty \frac{2}{1+t^2}e^{ixt}\,dt = 2\pi e^{-|x|}.
$$
Take $x = 1$ and divide both sides by $2$.