How would one evaluate $\int\frac{x\sin(x)}{x^2+1}$ over the real line? Another exam problem I'm looking at is to evaluate the following integral.
$$
\int_{-\infty}^{\infty} \frac{x\hspace{-0.04 in}\cdot\hspace{-0.04 in}\sin(x)}{x^{\hspace{.02 in}2}+1} dx
$$
This is a complex analysis exam, so the solution probably involves contours. $\:$ Since the integrand is an even function, one could potentially simplify by changing one endpoint to $0$. However, I have no idea how to make a contour work since the absolute value of the integrand grows exponentially away from the real axis. What does one need to do to evaluate that integral?
 A: Define
$$f(z)=\frac{ze^{iz}}{z^2+1}\;,\;\;C_R:=\{z=Re^{it}\in\Bbb C\;;\;R,t\in\Bbb R\;,\;0\le t\le \pi\}\;,\;$$
$$\gamma_r:=[-R,R]\cup C_R\;,\;\;\text{positively oriented}$$
For $\;R>1\;$ , our function has one unique simple pole at $\;z=i\;$ within $\;\gamma_R\;$ , with residue
$$\text{Res}_{z=i}(f)=\lim_{z\to i}\;(z-i)f(z)=\frac{ie^{-1}}{2i}=\frac1{2e}$$
So by Cauchy's Theorems
$$\frac{2\pi i}{2e}=\frac{\pi i}e=\oint\limits_{\gamma_R}f(z)dz=\int\limits_{-R}^R\frac{xe^{ix}}{x^2+1}dx+\int\limits_{C_R}f(z)dz$$
But by Jordan's Lemma
$$\left|\;\int\limits_{\gamma_R} f(z)dz\;\right|\xrightarrow [R\to\infty]{}0\;$$
So we get
$$\frac{\pi i}e=\int\limits_{-\infty}^\infty\frac{x(\cos x+i\sin x)}{x^2+1}dx$$
Take now just the imaginary parts in both sides to get the result.
A: By using Fourrier Transform
$$  \int^\infty_0 \frac{x \sin (ax)}{1 + x^2} \, dx= -\partial_a \int^\infty_0 \frac{\cos (ax)}{1 + x^2} \, dx = -\frac{1}{2}\partial_a \int_\Bbb R \frac{\cos (ax)}{1 + x^2} \, dx\\=-\frac{1}{2}\partial_a Re\left(\int_\Bbb R \frac{e^{iax}}{1 + x^2} \, dx\right)=-\frac{1}{2}\partial_a \left[Re\mathcal{F}^{-1}\left(\frac{1}{1 + x^2} \right)(a)\right]\\=\color{red}{-\frac{1}{2}\partial_a \left(\pi e^{-|a|}\right) =\frac{sign(a)\pi}{2} e^{-|a|}} $$
See all the explanatory details below

Recall that, if we consider the Fourier transform 
  $$\mathcal Ff (a) =\int_\Bbb R e^{-ia x}f(x)dx$$
  then its Fourier inverse  is defined as 
  $$\mathcal F^{-1}f (x) =\frac{1}{2\pi}\int_\Bbb R e^{it x}f(t)dt.$$

But we have, 
\begin{split}
\mathcal F(e^{-|t|})(x) = \int_{-\infty}^{\infty}e^{-|t|}e^{-ix t}\,dt
&=&\int_{-\infty}^{0}e^{t}e^{-ix t}\,dt+\int_{0}^{\infty}e^{-t}e^{-ix t}\,dt\\
 &=&\left[ \frac{e^{(1-ix)t}}{1-ix} \right]_{-\infty}^0-\left[\frac{e^{-(1+ix)t}}{1+ix} \right]_{0}^{\infty}\\
&=&\frac{1}{1-ix}+\frac{1}{1+ix}\\
&=&\color{red}{\frac{2}{x^2+1}.}
\end{split}
Then,
$$
\begin{align}
e^{-|a|}=\mathcal F^{-1}\left( \frac{2}{x^2+1}\right)(a) &=\frac{1}{2\pi}\int_\Bbb R \frac{2}{x^2+1}e^{ix a}\,dx =
\frac{1}{\pi}\int_\Bbb R\frac{e^{ix a}}{x^2+1}\,dx \\&=\frac{1}{\pi}\int_\Bbb R\frac{\cos a x}{x^2+1}\,dx = \frac{2}{\pi}\int_0^\infty\frac{\cos ax}{x^2+1}\,dx
\end{align}
$$
 Given that, as $x\mapsto\sin ax $ is an old function we have,
 $$\int_\Bbb R \frac{\sin{a x}}{x^2+1}dx= 0.$$
Thus we have,
$$
\int_0^\infty\frac{\cos ax}{x^2+1}\,dx =\frac{\pi}{2}e^{-|a|} 
$$
