Find the Principal Value of the integral $\int_{-\infty}^\infty \frac{x sin(x)}{x^2+2x+2}dx$ This problem comes from a preliminary exam from 2009
"Find the Principal Value of the integral 
$$\int_{-\infty}^\infty \frac{x \sin(x)}{x^2+2x+2}dx"$$
My attempt at solution: Letting $f(z)=\frac{z \sin(z)}{z^2+2z+2}$,  the residue theorem implies that $ \int_{-\infty}^\infty f(x)dx=2\pi i \text{Res}(f, -1+i)$, but I get that Res$(f, -1+i)=(\frac{1}{2}+\frac{i}{2})\sin(-1+i)$, and I don't know how to compute $\sin(-1+i)$. 
Also, I was hoping someone could help me to understand why the problem asks for the "Principal Value" rather than the value because the only singularities of the function $f(z)=\frac{z \sin(z)}{z^2+2z+2}$ are at $-1\pm i$, neither of which are on the real axis. 
 A: Note that the integral of interest can be written
$$\int_{-\infty}^{\infty}\frac{x\sin x}{x^2+2x+1}dx=\text{Im}\left(\int_{-\infty}^{\infty}\frac{xe^{ix}}{x^2+2x+1}dx\right) \tag 1$$
Let's examine the integral 
$$\oint_C\frac{ze^{iz}}{z^2+2z+1}dz$$
where $C$ is the closed contour comprised of 
$(i)$ the real-line segment from $(-R,0)$ to $(R,0)$
$(ii)$ the semicircle $C_R$ in the upper-half plane, centered at the origin with radius $R$.
Thus, we can write
$$\begin{align}
\oint_C\frac{ze^{iz}}{z^2+2z+1}dz&=\int_{-R}^{R}\frac{xe^{ix}}{x^2+2x+1}dx+
\int_{C_R}\frac{ze^{iz}}{z^2+2z+1}dz \tag 2\\\\
\end{align}$$
Note that in the limit as $R\to \infty$, the imaginary part of first integral on the right-hand side of $(2)$ equals the Cauchy Principal Value of the integral of interest in $(1)$.  The second integral on the right-hand side of $(2)$ can be shown using Jordan's Lemma to go to zero in the limit as $R\to \infty$.  Thus, from the residue theorem we have
$$\int_{-\infty}^{\infty}\frac{x\sin x}{x^2+2x+1}dx=\text{Im}\left(2\pi i \,\text{Res}\left(\frac{ze^{iz}}{z^2+2z+2},z=-1+i\right)\right)\tag 3$$
The residue in $(3)$ can be evaluated as 
$$\begin{align}
\text{Res}\left(\frac{ze^{iz}}{z^2+2z+2},z=-1+i\right)&=
\lim_{z\to -1+i}\frac{(z+1-i)ze^{iz}}{(z+1-i)(z+1+i)}\\\\
&= \frac{(-1+i)e^{i(-1+i)}}{2i} \\\\
&=\frac{e^{-1}}{2i}\sqrt{2}e^{i(3\pi/4-1)}\tag 4
\end{align}$$
Substituting $(4)$ into $(3)$ reveals that 
$$\bbox[5px,border:2px solid #C0A000]{\int_{-\infty}^{\infty}\frac{x\sin x}{x^2+2x+1}dx=\pi e^{-1}(\cos 1 -\sin 1)}$$
