Residue Theorem for odd function? I am trying to find a way to compute:
$$ \int_0^{\infty} \frac{x \sin(x) \, dx}{(x^2+1)^2} $$
I thought that I need to use residue theorem but $\sin(x)$ is an odd function and I do not know what to do about it. 
I computed the residue for $z=i$ because it is the one above real axis. From my computations it is: $ (i/8)  [\frac{1}{e} + e]. $
How to apply the residue theorem for that example? 

First note that since the numerator is the product of an odd and an odd function, it is even. Which means that
$$\int_0^\infty \frac{x\sin x}{(1+x^2)^2}\:dx= \frac{1}{2}\int_{-\infty}^\infty \frac{x\sin x}{(1+x^2)^2}\:dx$$
Furthermore we have by similar reasoning that
$$\int_{-\infty}^\infty \frac{x\cos x}{(1+x^2)^2}\:dx = 0 \implies \frac{1}{2}\int_{-\infty}^\infty \frac{x\sin x}{(1+x^2)^2}\:dx = \frac{1}{2i}\int_{-\infty}^\infty \frac{xe^{ix}}{(1+x^2)^2}\:dx$$
From this set the contour to be a large semicircle in the upper half plane. The even/odd function shenanigans were important because otherwise if we had used a quarter circle, our poles would have been on the contour.
The integral on the circular contour vanishes by dominated convergence, etc, so all we need to find are the residues and multiply by $2\pi i$. We have a pole of order $2$ located at $z=i$:
$$\frac{d}{dz}\left(\frac{ze^{iz}}{(z+i)^2}\right)\Biggr|_{z=i}=\frac{(2i)^2(e^{-1}-e^{-1})-2ie^{-1}(2i)}{(2i)^4}=\frac{1}{4e}$$
The original integral then is 
$$\pi\left(\frac{1}{2\pi i}\int_{-\infty}^\infty \frac{xe^{ix}}{(1+x^2)^2}\:dx\right) = \frac{\pi}{4e}$$
