Computing real integral using contour integral Let $\beta>0$, $x\ge 0$, $\alpha\in\mathbb{C}$. Compute $$\int_{-\infty}^\infty\dfrac{k^2+\beta^2+\beta}{(k^2+\alpha^2)(k^2+\beta^2)}\cos(kx)dk$$ Let $$f(k)=\dfrac{k^2+\beta^2+\beta}{(k^2+\alpha^2)(k^2+\beta^2)}$$ If $\alpha^2\in\mathbb{R}$, the integral equals $$\Re\left(\lim_{R\to\infty}\left(\int_Cf(k)e^{ikx}dk-\int_{C_R}f(k)e^{ikx}dk\right)\right)$$ where $C_R=\{|k|=R,\arg k\in(0,\pi)\}$ and $C=C_R\cup[-R,R]$. The integral over $C$ can be computed using Cauchy's residue theorem, with special cases $\alpha^2=\beta^2$ and $\alpha^2=\beta^2+\beta$. For all $k\in C_R$, $|e^{ikx}|\le 1$ since $\Im(k),x\ge 0$ and $|f(k)|=\Theta(R^{-2})$. $C_R$ has length $\pi R$, so the integral over $C_R$ has magnitude at most $\Theta(R^{-1})$, which tends to $0$ as $R\to\infty$, so $$\lim_{R\to\infty}\int_{C_R}f(k)e^{ikx}dk=0$$ so we can compute the integral when $\alpha^2\in\mathbb{R}$.
If $\alpha^2\not\in\mathbb{R}$, $f(k)\Re(e^{ikx})\neq \Re(f(k)e^{ikx})$, so this approach doesn't work. What do we do then?
This integral arises in the Fourier cosine transform solution to $y''-\alpha^2y=e^{-\beta x}$ for all $x\ge 0$ with $y'(0)=1$ and $y$ bounded as $x\to\infty$.
 A: Your integral
$$I(x) = \int_{-\infty}^\infty\dfrac{k^2+\beta^2+\beta}{(k^2+\alpha^2)(k^2+\beta^2)}\cos(kx)dk$$
is very close to an Inverse Fourier Transform
$$\begin{align*}g(x) &= \dfrac{1}{2\pi}\int_{-\infty}^\infty\dfrac{k^2+\beta^2+\beta}{(k^2+\alpha^2)(k^2+\beta^2)}e^{ikx}dk \\
&= \mathscr{F}^{-1}\left\{\dfrac{k^2+\beta^2+\beta}{(k^2+\alpha^2)(k^2+\beta^2)}\right\}\\
&=\mathscr{F}^{-1}\left\{\dfrac{1- \frac{\beta}{\alpha^2-\beta^2}}{k^2+\alpha^2}\right\} +\mathscr{F}^{-1}\left\{\dfrac{\frac{\beta}{\alpha^2-\beta^2}}{k^2+\beta^2}\right\}\\
&=\dfrac{1- \frac{\beta}{\alpha^2-\beta^2}}{2\alpha}\mathscr{F}^{-1}\left\{\dfrac{2\alpha}{k^2+\alpha^2}\right\} +\dfrac{\frac{\beta}{\alpha^2-\beta^2}}{2\beta}\mathscr{F}^{-1}\left\{\dfrac{2\beta}{k^2+\beta^2}\right\}\\
g(x) &=\dfrac{1- \frac{\beta}{\alpha^2-\beta^2}}{2\alpha}e^{-\alpha|x|} +\dfrac{\frac{\beta}{\alpha^2-\beta^2}}{2\beta}e^{-\beta|x|} \\
\end{align*}$$
for $\Re[\alpha] > 0$
Since your integrand in $I(x)$ looks like an even function, I believe the sine part of the Inverse Fourier Transform makes no contribution, so we can get away with saying
$$\begin{align*}I(x) = 2\pi g(x) &=2\pi\dfrac{1- \frac{\beta}{\alpha^2-\beta^2}}{2\alpha}e^{-\alpha|x|} +2\pi\dfrac{\frac{\beta}{\alpha^2-\beta^2}}{2\beta}e^{-\beta|x|}\\
&=\pi\dfrac{\alpha^2-\beta-\beta^2}{\alpha^2-\beta^2}\dfrac{e^{-\alpha|x|}}{\alpha} +\pi\dfrac{\beta}{\alpha^2-\beta^2}\dfrac{e^{-\beta|x|}}{\beta}\\
\end{align*}$$
for $\Re[\alpha] > 0$
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

Use partial fraction decomposition

$$
{k^{2} + \beta^{2} + \beta \over \pars{k^{2} + a^{2}}\pars{k^{2} + \beta^{2}}} =
{a^{2} - \beta - \beta^{2} \over a^{2} - \beta^{2}}
\,\color{red}{1 \over k^{2} + a^{2}} +
{\beta \over a^{2} - \beta^{2}}\,\color{red}{1 \over k^{2} + \beta^{2}}
$$
and the result
\begin{align}
\int_{-\infty}^{\infty}{\cos\pars{kx} \over k^{2} + q^{2}}\,\dd k & =
\Re\int_{-\infty}^{\infty}{\expo{\ic k\verts{x}} \over
\pars{k - \ic\verts{q}}\pars{k + \ic\verts{q}}}\,\dd k =
\Re\bracks{2\pi\ic\,{\exp\pars{\ic\verts{x}\bracks{\ic\verts{q}}} \over
\ic\verts{q} + \ic\verts{q}}}
\\[5mm] & = \pi\,{\expo{-\verts{qx}} \over \verts{q}}
\end{align}

Then,

$$
\int_{-\infty}^{\infty}{k^{2} + \beta^{2} + \beta \over \pars{k^{2} + a^{2}}\pars{k^{2} + \beta^{2}}}\,\cos\pars{kx}\,\dd k =
\bbx{\pi\,{a^{2} - \beta - \beta^{2} \over a^{2} - \beta^{2}}
\,{\expo{-\verts{ax}} \over \verts{a}} +
\pi\,{\beta \over a^{2} - \beta^{2}}\,{\expo{-\verts{\beta x}} \over \verts{\beta}}}
$$
