TITLE: How to evaluate $\displaystyle \int_{0}^{\infty }\frac{\cos x}{\left ( x^2+a^{2} \right )\left ( x^2+b^{2} \right )}~\mathrm{d}x$
QUESTION [6 upvotes]: With the Fourier Transformation ,we can easily get 
$$\int_{0}^{\infty }\frac{\cos x}{x^{2}+a^{2}}~\mathrm{d}x=\frac{\pi e^{-a}}{2a}~,~\Re\left ( a \right )> 0$$
and with help of wolframalpha I found
$$\int_{0}^{\infty }\frac{\cos x}{\left ( x^2+a^{2} \right )\left ( x^2+b^{2} \right )}~\mathrm{d}x=\frac{\pi ae^{-b}-\pi be^{-a}}{2a^{3}b-2ab^{3}}~,~\Re\left ( a \right )>0,\Re\left ( b \right )>0$$
But I don't know how to prove it.
In addition,I'd like to know is there a closed form for the general form below
$${\Large{\int}}_{0}^{\infty }\frac{\cos x}{\displaystyle \prod_{i=1}^{\infty }\left ( x^{2}+a_{i}^{2} \right )}~\mathrm{d}x~,~\Re(a_i)＞0$$

REPLY [3 votes]: Take $\;f(z):=\frac{e^{iz}}{z^2+a^2}\;,\;\;a>0\;$,  and the contour
$$C_R:=[-R,R]\cup\Gamma_R\;,\;\;\Gamma_R:=\{z=Re^{it}\in\Bbb C\;;\;\;0<t<\pi\}\;,\;\;\;R\in\Bbb R^+$$
Observe that within the domain enclosed by the above contour our function has one unique simple pole: $\;z=ai\;$ , so
$$\oint_{C_R}f(z)\,dz=2\pi i\cdot\text{Res}(f)|_{z=ai}$$
Now
$$\text{Res}(f)|_{z=ai}=\lim_{z\to ai}(z-ai)f(z)=\frac{e^{-a}}{2ai}\implies$$
$$\frac\pi{ae^a}=2\pi i\frac{e^{-a}}{2ai}=\oint_{C_R}f(z)\,dz=\int_{-R}^R\frac{e^{ix}}{x^2+a^2}dx+\int_{\Gamma_R}f(z)\,dz$$
But
$$\left|\int_{\Gamma_R}f(z)\right|\le\ell(\Gamma_R)\cdot\max_{z\in\Gamma_R}\frac{e^{iz}}{z^2+a^2}\le\frac{\pi R}{2|(R^2e^{it}+a^2)|}\le\frac{\pi R}{2R^2-2a^2}\xrightarrow[R\to\infty]{}0$$
So finally
$$\frac\pi{ae^a}=\lim_{R\to\infty}\oint_{C_R}f(z)\,dz=\int_{-\infty}^\infty\frac{\cos x+i\sin x}{x^2+a^2}dx$$
Now just compare real parts (and observe the integrand is an even function).