Prove that $\int\limits_{0}^{\infty} \frac{\sin x}{x(1+x^2)^2}dx = \frac{\pi(2e-3)}{4e}$.
There goes an extension of Cauchy's residue theorem that states if a finite number of poles lie directly on the contour $C$, then $\oint_C f(z)dz = 2\pi i \sum R^+ + \pi i \sum R^0$, where $\sum R^+$ denotes sum of residues at poles on the positive side of the contour and $\sum R^0$ denotes sum of residues at poles lying directly on the contour.
Here at the problem, at first I converted the integral $\oint_C \frac{e^{iz}}{z(z^2+1)^2}$ where $C$ is positive semicircular contour indented at $0$. Clearly the pole directly on the contour is $z=0$ and that one on the positive side being $z=i$ which is of order $2$. So calculating the residues at those poles and using the above extension and comparing imaginary parts on both sides should give us the correct result. But this isn't. Can someone explain why?
This version of the theorem relies on your function tending to $0$ rapidly enough on large arcs. What you are really doing is applying the residue theorem to semicircles of large radius $R$ in the upper half-plane and taking the limit as $R \rightarrow \infty$, and expecting the contribution from the arc to vanish in the limit.
This does not work with $\sin(z)$, which is unbounded. You'll be more successful calculating the integral of $\frac{e^{ix}}{x (1 + x^2)^2} \, \mathrm{d}x$ and taking its imaginary part. The contribution from the arc will then vanish, since $|e^{iz}|$ is so small when $\mathrm{Im}[z]$ is large.