How can $\sin x = e^{iz}$? This is probably a trivial question but I just don't see it. I'm solving the integral $$\int_{0}^{\infty}\dfrac{x \sin x }{x^2 + 5x + 4}dx$$ using the residue theorem. The thing is that they're substituting $sinx$ with $e^{iz}$, and i don't understand how.
 A: The Cauchy principal value of $~\displaystyle\int_{\color{red}{-\infty}}^\infty\dfrac{x\sin x}{x^2+5x+4}~dx~=~\dfrac\pi3~(4\cos4-\cos1).~$ In general, 
we have $~\displaystyle\int_{\color{red}{-\infty}}^\infty\dfrac{x\sin x}{(x+a)(x+b)}~dx~=~\pi\cdot\dfrac{a\cos a-b\cos b}{a-b}.~$ But integrating only over $\mathbb R_{\ge0}$ 
makes no sense, since the integrand lacks any symmetry with regard to the vertical axis. 
So integrate on the semicircular contour $R~e^{ia},~$ with $a\in(-\pi,~0),~$ and then let $R\to\infty.~$ 
A: It is not an elementary integral. By using the Laplace (inverse) transform, since
$$ \mathcal{L}(\sin x) = \frac{1}{1+s^2},\qquad \mathcal{L}^{-1}\left(\frac{x}{(x+1)(x+4)}\right) = \frac{4}{3}e^{-4s}-\frac{1}{3}e^{-3s}$$
we have:
$$ I=\int_{0}^{+\infty}\frac{x\sin x}{(x+1)(x+4)}\,dx = \frac{4}{3}\int_{0}^{+\infty}\frac{e^{-4s}}{1+s^2}\,ds - \frac{1}{3}\int_{0}^{+\infty}\frac{e^{-3s}}{1+s^2}\,ds $$
or 
$$\small{ I = -\frac{\pi}{6}\cos(1)+\frac{2\pi}{3}\cos(4)-\frac{1}{3} \text{Ci}(1) \sin(1)+\frac{4}{3}\text{Ci}(4)\sin(4)+\frac{1}{3}\cos(1)\text{Si}(1)-\frac{4}{3}\cos(4)\text{Si}(4)}$$
with $\text{Si}$ and $\text{Ci}$ being the sine integral and cosine integral functions.
