$\textbf{Problem:} \\\\
\text{Compute the following integral}$ $$\int_{-\infty}^{\infty}{\frac{cos(x)}{(x+a)^{2}+b^2}} \,dx$$
$\text{with } b>0.$
$\textbf{Solution:} \\\\$
$\text{Let }$ $$f(z) = \frac{e^{iz}}{(z+a)^{2}+b^{2}}$$
$\text{Then we have two poles: } z_1 = -a-ib ,\ z_2 = -a+ib$
$\text{Since we are looking for upper-half plane, then we have pole at } z=-a+ib \text{ with order 1.}$
$\text{(Denote the path as the pic attached below)}$
$\text{By Residual Theorem we have: }$
$
\begin{gather}
\begin{aligned}
\int_{\gamma}{f(z)} \,dz &= 2 \pi i \cdot Res{f; -a+ib} \\\\
&=2 \pi i \cdot \frac{e^{iz}}{z+a+ib}|_{z=-a+ib} \\\\
&= \frac{\pi e^{-b} e^{-ia}}{b}
\end{aligned}
\end{gather}
$
$\text{For path } c_2:$
$
\begin{gather}
\begin{aligned}
|\int_{c_2}{f(z)} \, dz| &= |\int_{0}^{\pi}{f(Re^{i\theta})Re^{i\theta}} \,d\theta| \\\\
&= |\int_{0}^{pi} {\frac{e^{iRe^{i\theta}}}{(Re^{i\theta}+a)^{2}+b^{2}}} \,d\theta| \\\\
&\leq \pi R \cdot |max(f(z))| \\\\
&= \pi R \cdot max|\frac{e^{iRe^{i\theta}}}{(Re^{i\theta}+a)^{2}+b^{2}}| \\\\
&= \pi R \cdot max\frac{e^{|iR(cos(\theta)+isin(\theta))}|}{|(Re^{i\theta}+a)^{2}+b^{2}|}\\\\
&\leq \pi R \cdot \frac{e^{-Rsin(\theta)}}{|(R+a)^{2} - b^{2}|} \ \ \ \ \ \text{(since triangle inequality)} \\\\
&\leq \pi R \cdot \frac{e^{0}}{(R+a)^{2}+b^{2}} \\\\
&= 0 \ \ \text{as R} \rightarrow \infty \\\\
\end{aligned}
\end{gather}
$ $$\text{(By comparing the power of R on both numerator and denominator.)}$$
$\text{Now solve for path } c_1:$
$
\begin{gather}
\begin{aligned}
\int_{c_1}{f(z)}\,dz &= \int_{-\infty}^{\infty}{\frac{e^{ix}}{(x+a)^{2}+b^{2}}}\,dx \\\\
&= \int_{-\infty}^{\infty}{\frac{cos(x)}{(x+a)^{2}+b^{2}}}\,dx + i\int_{-\infty}^{\infty}{\frac{sin(x)}{(x+a)^{2}+b^{2}}}\,dx \\\\
\end{aligned}
\end{gather}
$
$\text{Since the imaginary part of the integral is an odd function, thus its integral is 0.}$
$\text{Thus we have:}$
$$\int_{-\infty}^{\infty}{\frac{cos(x)}{(x+a)^{2}+b^{2}}}\,dx = \frac{\pi e^{-b} e^{-ia}}{b}$$