Evaluating the integral $\int_0^\infty \frac{x \sin rx }{a^2+x^2} dx$ using only real analysis Calculate the integral$$ \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,\quad a,r \in \mathbb{R}. $$ 
Edit: I was able to solve the integral using complex analysis, and now I want to try and solve it using only real analysis techniques.
 A: 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.
A: 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! :)
A: 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$.
A: Disclaimer: This answer was posted before the OP asked for a proof using only real analysis. See the revision history.
Let $S=\{-ia, ia\}$ and let $ \varphi \colon \Bbb C\setminus S\to \Bbb C, z\mapsto\dfrac{ze^{i(rz)}}{(z^2+a^2)}$.
Given $n\in \Bbb N$ such that $n> a$, define $\gamma (n):=\gamma _1(n)\lor \gamma _2(n)$ with $\gamma _1(n)\colon [-n,n]\to \Bbb C, t\mapsto t$ and $\gamma _2(n)\colon [0,\pi]\to \Bbb C, \theta \mapsto ne^{i\theta}$, ($\gamma (n)$ is an upper semicircle).
Note that $S$ is the set of singularities of $\varphi$ and all of them are simple poles.
I'll be assuming that $r,a\ge0$, the other cases is similar. It follows that $\text{Res}(\varphi, ia)=\left.\dfrac{ze^{irz}}{z+ia}\right|_{z=ia}=\dfrac {e^{-ar}}2$, which is what you got. It doesn't matter what $\text{Res}(\varphi, -ia)$ is.
Quick considerations about winding numbers, inside and outside region of $\gamma(n)$, the fact that $n>a$, the fact that $\varphi$ is holomorphic and the residue theorem yield $$\displaystyle \int \limits_{\gamma (n)}\varphi=2\pi i\cdot \dfrac {e^{-ar}}2=\pi e^{-ar}i.$$
On the other hand $$\int \limits_{\gamma (n)}\varphi=\int \limits _{\gamma _1(n)}\varphi +\int \limits_{\gamma _2(n)}\varphi \tag I$$
Note that $$\displaystyle\int \limits _{\gamma _1(n)}\varphi=\int \limits _{-n}^n\varphi (t)dt=\int \limits_{-n}^n\dfrac{te^{i(rt)}}{t^2+a^2}\mathrm dt=\int \limits_{-n}^n\dfrac{t\cos(rt)+it\sin (rt)}{t^2+a^2}\mathrm dt=i\int \limits _{-n}^n\dfrac{t\sin (rt)}{t^2+a^2}\mathrm dt.$$
The last equality is due to $t\mapsto \dfrac{t\cos (rt)}{t^2+a^2}$ being an odd function and due to the integral being computed on a symmetric interval.
It can be proven that $\displaystyle \lim \limits_{n\to +\infty}\left(\int _{\gamma _2(n)}\varphi\right)=0$, I won't prove this unless you're having trouble with it. In any case, Zaid just brought to my attention this a consequence of a known result, namely Jordan's Lemma.
Thus, taking the limit in $(\text{I})$ yields $\displaystyle \pi e^{-ar}i=i\int \limits _{-\infty}^\infty\dfrac{t\sin (rt)}{t^2+a^2}\mathrm dt.$
A: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{\int_{0}^{\infty}{x\sin\pars{rx} \over a^{2} + x^{2}}\,\dd x:\ {\large ?}}$.

It's $\large\tt\underline{possible}$ to evaluate the integral
  $\ds{\large\tt\mbox{without a Complex Contour !!!}}$

Note that
\begin{align}
&\color{#c00000}{\int_{0}^{\infty}{x\sin\pars{rx} \over a^{2} + x^{2}}\,\dd x}
=-\,\partiald{}{r}\int_{0}^{\infty}{\cos\pars{rx} \over a^{2} + x^{2}}\,\dd x
=-\,\half\,\Re\partiald{\fermi\pars{r}}{r}
\\[3mm]&\mbox{where}\quad\fermi\pars{r}\equiv
\int_{-\infty}^{\infty}{\expo{\ic rx} \over a^{2} + x^{2}}\,\dd x\,,\qquad
\fermi\pars{0} = {\pi \over \verts{a}}\tag{1}
\end{align}
\begin{align}
&\partiald[2]{\fermi\pars{r}}{r}\equiv
\int_{-\infty}^{\infty}{-x^{2}\expo{\ic rx} \over a^{2} + x^{2}}\,\dd x
=-2\pi\,\delta\pars{r} + a^{2}\fermi\pars{r}\,,\ \imp\
\pars{\partiald[2]{}{r} - a^{2}}\fermi\pars{r} = -2\pi\,\delta\pars{r}
\end{align}

Then,
  $$
\left.\fermi\pars{r}\right\vert_{\,r\ <\ 0}={\pi \over \verts{a}}\expo{\verts{a}r}\,,\qquad
\left.\fermi\pars{r}\right\vert_{\,r\ >\ 0}={\pi \over \verts{a}}\,\expo{-\verts{a}r}
$$
  which is continuous at $\ds{r = 0}$ and satisfies
  $\ds{\fermi'\pars{0^{+}} - \fermi'\pars{0^{-\vphantom{+}}} = -2\pi}$

$$
\fermi\pars{r} = {\pi \over \verts{a}}\,\expo{-\verts{a}\verts{r}}
$$

$$\color{#66f}{\large%
\int_{0}^{\infty}{x\sin\pars{rx} \over a^{2} + x^{2}}\,\dd x}
=-\,\half\,\partiald{}{r}\pars{{\pi \over \verts{a}}\,\expo{-\verts{a}\verts{r}}}
=\color{#66f}{\large\half\pi\,\sgn\pars{r}\expo{-\verts{ar}}}
$$

A: We can use the following known results to evaluate
$$ \int_0^\infty e^{-xt}\cos (at)dt=\frac{x}{a^2+x^2}, \int_0^\infty\frac{\cos(\pi x)}{r^2+x^2}dx=\frac{\pi}{2re^{ar}}. $$
So 
\begin{eqnarray}
I&=&2\int_0^\infty \frac{x\sin(rx)}{a^2+x^2}dx=\int_0^\infty \sin(r x) \left(\int_0^\infty e^{-xt}\cos(at)dt\right)dx\\
&=&\int_0^\infty\cos(at)\left(\int_0^\infty e^{-xt}\sin(rx)dtx\right)dt\\
&=&r\int_0^\infty\frac{\cos(a t)}{r^2+t^2}dt\\
&=&\frac{\pi}{2e^{ar}}.
\end{eqnarray}
