Evaluate improper integral $\int_0^\infty \frac{x\sin x}{x^2+1}dx$ How to prove that $$\int_0^\infty \frac{x\sin x}{x^2+1}dx=\frac{\pi}{2e}$$
I've tried several basic approaches like substitution and IBP but can't move forward. 

Suppose we are interested in 
$$J = \int_0^\infty \frac{x\sin(x)}{1+x^2} dx$$
In  view of  the  ML  bound that  we  will be  using  later it  proves
convenient to write this as
$$\left[ -\frac{x\cos(x)}{1+x^2} \right]_0^\infty
+ \int_0^\infty \frac{1-x^2}{(1+x^2)^2} \cos(x) dx
= \frac{1}{2} 
\int_{-\infty}^\infty \frac{1-x^2}{(1+x^2)^2} \cos(x) dx.$$
Observe that this is
$$\frac{1}{2} \Re \int_{-\infty}^\infty 
\frac{1-x^2}{(1+x^2)^2} \exp(ix) dx.$$
Therefore we integrate
$$f(z) = \frac{1-z^2}{(1+z^2)^2} \exp(iz)$$
around a semicircular  contour of radius $R$ in  the upper half plane,
which consists of a horizontal segment $\Gamma_1$ on the real axis and
a  semicircle $\Gamma_2$  in the  upper half  plane. Now  the integral
along $\Gamma_1$ is the integral we  seek to evaluate in the limit and
the integral along  $\Gamma_2$ vanishes. This is because  we have from
the  ML  bound   (parameterize  $\Gamma_2$  by  $R\exp(i\theta)$  with
$0\le\theta\le\pi$)
$$\lim_{R\rightarrow\infty} \pi R \times
\frac{(R^2+1) |\exp(iR\exp(i\theta))|}{(R^2-1)^2}
\\ = \lim_{R\rightarrow\infty} \pi R \times
\frac{(R^2+1) |\exp(iR\cos(\theta)+i^2R\sin(\theta))|}{(R^2-1)^2}
\\ = \lim_{R\rightarrow\infty} \pi R \times
\frac{(R^2+1) |\exp(-R\sin(\theta))|}{(R^2-1)^2}.$$
Now we  have $|\exp(-R\sin(\theta))|\le 1$  because $0\le\theta\le\pi$
so we  get two terms,  the first of  which is $O(1/R)$ and  the second
$O(1/R^3)$ so they both vanish  in the limit and the contribution from
the circular segment $\Gamma_2$ is zero.

This yields
$$J =  \frac{1}{2} \times \Re(2\pi i \; \mathrm{Res}_{z=i} f(z)).$$
We require the second term in the Taylor series of
$$\frac{1-z^2}{(z+i)^2} \exp(iz)$$
at $z=i$ 
which is 
$$\left.\left(\frac{-2z\exp(iz)+(1-z^2)i\exp(iz)}{(z+i)^2}
- 2 \frac{1-z^2}{(z+i)^3} \exp(iz)\right)\right|_{z=i}.$$
The first term here is zero and the second is
$$-2\frac{2}{(2i)^3} \exp(-1)
= \frac{1}{2} \frac{1}{i} \exp(-1).$$
Substitute this into the formula for $J$ to finally obtain
$$J=\frac{1}{2} \Re(2\pi i \exp(-1)/2/i)
= \frac{\pi}{2e}.$$
