Evaluating the integral $\int_0^\infty \frac{x \sin rx }{a^2+x^2} dx$ using only real analysis
It looks like I'm too late but still I wanna join the party. :D
Consider $$ \int_0^\infty \frac{\cos rx}{x^2+a^2}\ dx=\frac{\pi e^{-ar}}{a}. $$ Differentiating the both sides of equation above with respect to $r$ yields $$ \begin{align} \int_0^\infty \frac{d}{dr}\left(\frac{\cos rx}{x^2+a^2}\right)\ dx&=\frac{d}{dr}\left(\frac{\pi e^{-ar}}{a}\right)\\ -\int_0^\infty \frac{x\sin rx}{x^2+a^2}\ dx&=(-a)\frac{\pi e^{-ar}}{a}\\ \Large\int_0^\infty \frac{x\sin rx}{x^2+a^2}\ dx&=\Large\pi e^{-ar}. \end{align} $$ Done! :)
Here is an approach using only real analysis. We will first take $a$ and $r$ both positive.
Under the change of variables $x = au$ we have $$ \int_{-\infty}^\infty \frac{x\sin(rx)}{a^2+x^2}\,dx = \int_{-\infty}^{\infty} \frac{u\sin(ar u)}{1+u^2}\,du $$ and under the change of variables $x = u/r$ we have $$ \int_{-\infty}^\infty \frac{x\sin(rx)}{a^2+x^2}\,dx = \int_{-\infty}^\infty \frac{u\sin u}{(ar)^2+u^2}\,du. $$ Either way, we see the integral depends on $a$ and $r$ only through the value of $ar$ and it'd be simpler to ask about the one-parameter integral $$ \int_{-\infty}^\infty \frac{u\sin(cu)}{1+u^2}\,du = \int_{-\infty}^\infty \frac{u\sin u}{c^2+u^2}\,du $$ for $c > 0$, and then set $c = ar$.
See section 11 of http://www.math.uconn.edu/~kconrad/blurbs/analysis/diffunderint.pdf, where it is shown by differentiation under the integral sign (this does not depend on complex analysis) that for $t \geq 0$, $$ \int_{-\infty}^{\infty} \frac{\cos(tx)}{1+x^2}\,dx = \pi e^{-t}. $$ If for $t > 0$ you differentiate both sides with respect to $t$ and can justify differentiation under the integral sign, you'd get $$ \int_{-\infty}^{\infty} \frac{-x\sin(tx)}{1+x^2}\,dx = -\pi e^{-t}, $$ so $$ \int_{-\infty}^{\infty} \frac{x\sin(tx)}{1+x^2}\,dx = \pi e^{-t}. $$ Then for positive $a$ and $r$ we'd get $$ \int_0^\infty \frac{x\sin(rx)}{a^2+x^2}\,dx = \frac{1}{2}\int_{-\infty}^\infty \frac{x\sin(rx)}{a^2+x^2}\,dx = \frac{1}{2}\int_{-\infty}^{\infty} \frac{u\sin(aru)}{1+u^2}\,du = \frac{1}{2}\pi e^{-ar}. $$ If $a < 0$ the integral doesn't change, and if $r < 0$ the integral changes its value by $-1$, so for nonzero $a$ and $r$ we'd obtain $$ \int_0^\infty \frac{x\sin(rx)}{a^2+x^2}\,dx = \frac{{\rm sign}(r)}{2}\pi e^{-|ar|}. $$ This remains valid for $r = 0$ if we take ${\rm sign}(0) = 0$. For $a = 0$ the integral is $\int_0^\infty (\sin(rx)/x)\,dx$. For $r > 0$ that is $\int_0^\infty (\sin(x)/x)\,dx$, which is well-known to be $\pi/2$ (see the appendix of my link above for a tedious proof avoiding complex analysis). For $a = 0$ and $r < 0$ the integral is $-\pi/2$. Therefore the displayed formula above is valid for all $a$ and $r$ in $\mathbf R$ provided you can justify differentiation under the integral sign on the left side of $$ \int_{-\infty}^{\infty} \frac{\cos(tx)}{1+x^2}\,dx = \pi e^{-t}. $$ I point out in the link above that the standard hypotheses justifying differentiation under the integral sign do not apply to the integral on the left.
HINT:
Observe that the integrand is an even function i.e. $f(-x)=f(x)$. Hence notice that your integral is an half of the value of the integral on the whole $\mathbb R$.
Use this and compute the integral of the complex function you wrote on the following path: $\gamma_R=[-R,R],\left[R,R+i\frac a{2}\right], \left[R+i\frac a{2}, -R+i\frac a{2}\right], \left[-R+i\frac a{2},-R\right]$ (say, wlog $a>0$).
Now $g(z)=\frac{ze^{irz}}{a^2+z^2}$ has no pole inside $\gamma_R$, $\forall R>0$ hence we have $\int_{\gamma_R}g(z)\,dz=0$. Then take the limit for $R\rightarrow+\infty$.