Calculating the integral $\int_0^{\infty} \frac{\cos (kx)}{x^2+a^2} dx$ as an double integral I want to calculate:  $$\int_0^{\infty} \frac{\cos (kx)}{x^2+a^2} \tag{1}  $$ 
Therefore I can use:  $$\frac{x}{a^2+x^2}=\int_{0}^{\infty}e^{-ay}\sin (xy)dy \tag{2}$$
$2 \ in \  1  $ leads to:
 $$I=\int_{0}^{\infty}\frac{\cos kx}{a^2+x^2}dx=\int_{0}^{\infty}\frac{\cos kx}{x}dx\int_{0}^{\infty}e^{-ay}\sin (xy)dy.$$
Changing the order of integration yields( I'm not sure how to justify that. Maybe I can use Fubini/Tonelli ?!):
$$I=\int_{0}^{\infty}e^{-ay}dy\int_{0}^{\infty}\frac{\sin xy}{x} \cos kx dx. $$
I know: $$ \int_{0}^{\infty}\frac{\sin x}{x} dx = \frac{\pi}{2}  \tag{3}$$
How can I use $3$ to calculate  $$ \int_{0}^{\infty}\frac{\sin xy}{x} \cos kx dx. $$
 A: Given the integral:
$$I(k) := \int_0^{\infty} \frac{\cos(k\,x)}{x^2 + a^2}\,\text{d}x $$
with $a,\,k > 0$, differentiating under the integral sign, we have:
$$I'(k) = \int_0^{\infty} -\frac{x\,\sin(k\,x)}{x^2 + a^2}\,\text{d}x \,.$$
Now, adding both members as follows:
$$I'(k) + b = \int_0^{\infty} -\frac{x\,\sin(k\,x)}{x^2 + a^2}\,\text{d}x + \int_0^{\infty} \frac{\sin(k\,x)}{x}\,\text{d}x\,, $$
where $b$ is known but we don't care, we get:
$$I'(k) + b = \int_0^{\infty} \frac{a^2\,\sin(k\,x)}{x\left(x^2 + a^2\right)}\,\text{d}x$$
and therefore it's again possible differentiating under the integral sign, obtaining:
$$I''(k) = a^2\int_0^{\infty} \frac{\cos(k\,x)}{x^2 + a^2}\,\text{d}x\,,$$
ie:
$$I''(k) = a^2\,I(k)\,.$$
Solving this differential equation, we have:
$$I(k) = c_1\,e^{a\,k} + c_2\,e^{-a\,k}$$
where $c_1$ and $c_2$ are two constants to be determined.
In particular, noting that:
$$|I(k)| \le I(0) = \int_0^{\infty} \frac{1}{x^2 + a^2}\,\text{d}x = \frac{\pi}{2\,a}$$
it follows trivially that:
$$I(k) = 0\cdot e^{a\,k} + \frac{\pi}{2\,a}\cdot e^{-a\,k}\,,$$
ie:
$$\int_0^{\infty} \frac{\cos(k\,x)}{x^2 + a^2}\,\text{d}x = \frac{\pi}{2\,a}\,e^{-a\,k}\,,$$
as we wanted to prove.

A slightly different way is to remember that:
$$\frac{a^2}{x^2 + a^2} = \int_0^{\infty} e^{-\frac{x}{a}\,y}\,\sin y\,\text{d}y$$
$$\frac{x}{x^2 + k^2} = \int_0^{\infty} e^{-x\,y}\,\cos (k\,y)\,\text{d}y$$
with $a,\,k,\,x > 0$, then:
$$I(k) = \frac{1}{a^2}\int_0^{\infty} \cos(k\,x)\,\text{d}x \int_0^{\infty} e^{-\frac{x}{a}\,y}\,\sin y\,\text{d}y$$
ie:
$$I(k) = \frac{1}{a^2}\int_0^{\infty} e^{-\frac{y}{a}\,x}\,\cos(k\,x)\,\text{d}x \int_0^{\infty} \sin y\,\text{d}y$$
from which:
$$I(k) = \frac{1}{a^2}\,\int_0^{\infty} \frac{(y/a)\,\sin y}{(y/a)^2 + k^2}\,\text{d}y = -\frac{1}{a} \int_0^{\infty} -\frac{x\,\sin(k\,x)}{x^2 + a^2}\,\text{d}x\,,$$
ie:
$$I(k) = -\frac{1}{a}\,I'(k)\,.$$
Solving this differential equation, we have:
$$I(k) = c_1\,e^{-a\,k}$$
and since:
$$I(0) = \int_0^{\infty} \frac{1}{x^2 + a^2}\,\text{d}x = \frac{\pi}{2\,a}$$
it follows trivially that:
$$I(k) = \frac{\pi}{2\,a}\cdot e^{-a\,k}\,,$$
ie:
$$\int_0^{\infty} \frac{\cos(k\,x)}{x^2 + a^2}\,\text{d}x = \frac{\pi}{2\,a}\,e^{-a\,k}\,,$$
as we wanted to prove.
A: FYI, be careful with how you write your integrals. You've written them to appear like a product of two integrals, whereas you want them to be an iterated integral. See below for the correct way to write that.
Anyways, to answer your question,

$$I=\int_{0}^{\infty}e^{-ay}\left[\int_{0}^{\infty}\frac{\sin xy}{x} \cos (kx) dx\right] dy. $$
I know: $$ \int_{0}^{\infty}\frac{\sin x}{x} dx = \frac{\pi}{2}  \tag{3}$$
How can I use $3$ to calculate  $$ \int_{0}^{\infty}\frac{\sin xy}{x} \cos kx dx. $$

The key is the product-to-sum identity
$$
\sin(xy)\cos(kx) = \frac{\sin([y+k]x)+\sin([y-k]x)}{2}
$$
combined with a change of variables:
$$
\int_0^\infty \frac{\sin(rx)}{x}dx = \int_0^\infty \frac{\sin(\mathrm{sgn}(r)|r|x)}{|r|x}|r|dx = \mathrm{sgn}(r)\int_0^\infty \frac{\sin(u)}{u}du = \frac{\pi}{2}\mathrm{sgn}(r).
$$
$\mathrm{sgn}$ is the signum function, which is $1$ for positive numbers, $-1$ for negative numbers, and $0$ for $0$. Putting these together gives
$$
I=\int_{0}^{\infty}e^{-ay}\left[\int_{0}^{\infty}\frac{\sin xy}{x} \cos (kx) dx\right] dy = \int_0^\infty e^{-ay}\left[\int_0^\infty\frac{\sin([y+k]x)+\sin([y-k]x)}{2x}dx\right]dy \\= \int_0^\infty e^{-ay}\left(\frac{\pi}{4}\left[\mathrm{sgn}(y+k)+\mathrm{sgn}(y-k)\right]\right)dy = \frac{\pi}{2}\int_0^{|k|}e^{-ay}dy = \frac{\pi}{2a}e^{-|k|a}
$$
As for Fubini's theorem, it's not strictly speaking justified here as the double integral isn't absolutely convergent. It is absolutely convergent on every finite subset of the region of integration, though, which might be enough.
