How do I prove $\int_{-\infty}^{\infty}{\cos(x+a)\over (x+b)^2+1}dx={\pi\over e}{\cos(a-b)}$? How do I prove these?
$$\int_{-\infty}^{\infty}{\sin(x+a)\over (x+b)^2+1}dx={\pi\over e}\color{blue}{\sin(a-b)}\tag1$$
$$\int_{-\infty}^{\infty}{\cos(x+a)\over (x+b)^2+1}dx={\pi\over e}\color{blue}{\cos(a-b)}\tag2$$
I am trying to apply the residue theorem to $(2)$
$$f(x)={\cos(x+a)\over (x+b)^2+1}$$
$(x+b)^2+1$=$(x+b-i)(x+b+i)$
$$2\pi{i}Res(f(x),-b-i)=2\pi{i}\lim_{x\rightarrow -b-i}{\cos(a-b-i)\over -2i}=-\pi\cos(a-b-i)$$
$$2\pi{i}Res(f(x),-b+i)=2\pi{i}\lim_{x\rightarrow -b+i}{\cos(a-b+i)\over 2i}=\pi\cos(a-b+i)$$
How do I suppose to evaluate $\cos(a-b-i)$ and $\cos(a-b+i)$?
 A: $$\int_{-\infty}^{\infty}{\cos(x+a)\over (x+b)^2+1}dx=\cos (a-b)\int_{-\infty}^{\infty}{\cos x\over x^2+1}dx-\sin (a-b)\int_{-\infty}^{\infty}{\sin x\over x^2+1}dx$$
Let $\lambda\in\mathbb{R}$, set
$$I(\lambda)=\int_{-\infty}^{\infty}{\cos(\lambda x)\over x^2+1}dx$$
we use integrate by parts, writing
$$u=\frac{1}{{{x}^{2}}+1}\quad,\quad dv=\cos (\lambda x)$$
we have
$$I(\lambda )=\frac{\sin (\lambda x)}{\lambda ({{x}^{2}}+1)}\left| \begin{matrix}
   \infty   \\
   -\infty   \\
\end{matrix} \right.+\frac{2}{\lambda }\int_{-\infty }^{+\infty }{\frac{\sin (\lambda x)}{{{({{x}^{2}}+1)}^{2}}}}\,dx
$$
as a result
$$\lambda I(\lambda )=2\int_{-\infty }^{\infty }{\frac{x\sin \lambda x}{{{({{x}^{2}}+1)}^{2}}}\,}dx \,.\quad(1)$$
By differentiate with respect $\lambda$ to get
$$\lambda \frac{dI}{d\lambda }+I(\lambda )=2\int_{-\infty }^{\infty }{\frac{{{x}^{2}}\cos \lambda x}{{{({{x}^{2}}+1)}^{2}}}\,}dx=\underbrace{2\int_{-\infty }^{\infty }{\frac{\cos \lambda x}{{{x}^{2}}+1}\,}dx}_{2I(\lambda )}-2\int_{-\infty }^{\infty }{\frac{\cos \lambda x}{{{({{x}^{2}}+1)}^{2}}}\,}dx$$
therefore
$$\lambda \frac{dI}{d\lambda }-I(\lambda )=-2\int_{-\infty }^{\infty }{\frac{\cos \lambda x}{{{({{x}^{2}}+1)}^{2}}}\,}dx$$
and 
$$\lambda \frac{{{d}^{2}}I}{d{{\lambda }^{2}}}=2\int_{-\infty }^{\infty }{\frac{x\sin \lambda x}{{{({{x}^{2}}+1)}^{2}}}\,}dx.\quad(2)$$
$(1)$ and $(2)$
$$\frac{{{d}^{2}}I(\lambda)}{d{{\lambda }^{2}}}- I(\lambda )=0$$
thus
$$I(\lambda)=c_1e^{\lambda}+c_2e^{-\lambda}$$
on the other hand
\begin{align}
  & I(0)={{c}_{1}}+{{c}_{2}}=\int_{-\infty }^{+\infty }{\frac{1}{{{x}^{2}}+1}}\,dx=\pi \,\,\,\,\Rightarrow \,\,{{c}_{1}}+{{c}_{2}}=\pi \, \\ 
 & I(\lambda )=\frac{2}{\lambda }\int_{-\infty }^{+\infty }{\frac{x\sin \lambda x}{{{({{x}^{2}}+1)}^{2}}}\,\,}dx\,\,\,\Rightarrow \,\,\underset{\lambda \to \infty }{\mathop{\lim }}\,I(\lambda )=0\,\,\,\Rightarrow \,{{c}_{1}}=0 \\ 
\end{align}
then
$$I(\lambda )=\pi {{e}^{-\lambda }}$$
set $\lambda=1$, we have

$$\cos (a-b)\int_{-\infty}^{\infty}{\cos x\over x^2+1}dx=\frac{\pi}{e}\cos (a-b)$$

Now set 
$$J(\lambda)=\int_{-\infty}^{\infty}{\sin(\lambda x)\over x^2+1}dx$$
WE repeat this produce,to get
$$J(\lambda)=c_1e^{\lambda}+c_2e^{-\lambda}$$
and
\begin{align}
  & J(0)={{c}_{1}}+{{c}_{2}}=0 \\ 
 & \underset{\lambda \to \infty }{\mathop{\lim }}\,J(\lambda )=0\Rightarrow \,{{c}_{1}}=0 \\ 
\end{align}
i.e. $J(\lambda)=0$ thus

$$\int_{-\infty}^{\infty}{\cos(x+a)\over(x+b)^2+1}dx=\frac{\pi}{e}\cos(a-b)$$

A: With residues at hand you are well equipped to evaluate these improper integrals.
But before doing so I'd propose to transform: Shift $x$ to get rid of $b$ in the denominator, $(1)$ then reads 
$$\int_{-\infty}^\infty{\sin(x+a)\over (x+b)^2+1}\,dx\; =\;
\int_{-\infty}^\infty{\sin(x+a-b)\over x^2+1}\,dx\:,$$
and apply trigonometric addition formulae to the numerator to obtain
$$ =\: \sin(a-b)\int_{-\infty}^\infty{\cos x\over x^2+1}\,dx\; +\;
\cos(a-b)\int_{-\infty}^\infty{\sin x\over x^2+1}\,dx\:,$$
with a vanishing second integral—note that its integrand is an odd function.
Treating $(2)$ along the same lines yields
$$\cos(a-b)\int_{-\infty}^\infty{\cos x\over x^2+1}\,dx\; .$$
The remaining integral to be evaluated
$$\int_\mathbb{R}{\cos x\over x^2+1}\,dx$$
is well-known, cf. Jack D'Aurizio's answer, it is a showcase for the calculus of residues.
Remark: The method extends to the more general case where an even power $x^{2n}$ is present in the denominator, instead of $x^2$.
A: You may compute both integrals at once by computing
$$ \int_{-\infty}^{+\infty}\frac{e^{i(x+a)}}{(x+b)^2+1}\,dx $$
(i.e. the rescaled Fourier transform of $\frac{1}{x^2+1}$) then considering the real/imaginary part.
Since the CF of the Laplace distribution is well-known and easy to compute, the claim is trivial by Fourier inversion. Using residues:
$$\int_{-\infty}^{+\infty}\frac{e^{i\xi x}}{x^2+1}\,dx = 2\pi i\cdot\text{Res}\left(\frac{e^{i\xi x}}{x^2+1},x=\pm i\right) = \pi e^{-|\xi|} $$
by simply considering a semicircular contour in the upper or lower half-plane, according to the sign of $\xi\in\mathbb{R}$.
