Is this a correct way to calculate $\int_{-\infty}^\infty\frac{x\sin(\pi x)}{x^2+2x+5}dx?$ I have this integral to calculate: $$I=\int_{-\infty}^\infty\frac{x\sin(\pi x)}{x^2+2x+5}dx.$$
I think I have done it, but I would like to make sure my solution is correct.
I take the function $$f(z)=\frac{ze^{i\pi z}}{z^2+2z+5}$$ for $z\in\Bbb C.$ Now 
$$f(z)=\frac{z\cos(\pi z)}{z^2+2z+5}+i\frac{z\sin(\pi z)}{z^2+2z+5}$$ 
so 
$$\int_{-\infty}^\infty f(x)dx=\int_{-\infty}^\infty\frac{x\cos(\pi x)}{x^2+2x+5}dx+i\int_{-\infty}^\infty\frac{x\sin(\pi x)}{x^2+2x+5}dx.$$
Therefore, to calculate $I$, I need to calculate the left-hand side and take the imaginary part of it.
I consider contours $C_R$ composed of the upper half-circles $H_R$ of radius $R$ and the real interval $I_R=[-R,R]$. $f$ has two simple poles, $-1+2i$ and $-1-2i$, of which only $-1+2i$ lies in the upper half-plane. I have
$$\mathrm{res}_{(-1+2i)}f=\frac{(-1+2i)e^{i\pi(-1+2i)}}{2(-1+2i)+2}=-\frac14(2+i)e^{-2\pi}.$$
Therefore, $$\int_{H_R} f(z)dz+\int_{I_R} f(z)dz=\int_{C_R} f(z)dz=2i\pi\cdot(-\frac14)(2-i)e^{-2\pi}=\frac\pi 2(1-2i)e^{-2\pi}.$$
$\int_{H_R} f(z)dz$ tends to zero as $R$ tends to infinity by Jordan's lemma. I have 
$$\begin{eqnarray}|\int_{H_R}f(z)dz|&\leq&\max_{\theta\in[0,\pi]}|\frac{Re^{i\theta}}{(Re^{i\theta})^2+2Re^{i\theta}+5}|\\&=&\max_{\theta\in[0,\pi]}\frac R{|(Re^{i\theta})^2+2Re^{i\theta}+5|}\\&\leq&\frac R{R^2-2R-5},\end{eqnarray}$$
by this. The last expression tends to zero as $R$ tends to infinity.
$\int_{I_R} f(z)dz$ tends to $\int_{-\infty}^\infty f(x)dx$ as $R$ tends to infinity. Therefore,
$$\int_{-\infty}^\infty f(z)dz=\frac\pi 2(1-2i)e^{-2\pi}=\frac\pi 2e^{-2\pi}-i\pi e^{-2\pi},$$
whence $$I=-\pi e^{-2\pi}.$$
 A: Using Laplace Transform to calculate this improper integral will be much easier. In fact, since
\begin{eqnarray*}
\mathcal{L}\left\{\frac{x}{x^2+2x+5}\right\}&=&\mathcal{L}\left\{\frac{-1+2i}{4i}\frac{1}{x+1-2i}+\frac{1+2i}{4i}\frac{1}{x+1+2i}\right\}\\
&=&\frac{-1+2i}{4i}e^{(1-2i)s}\Gamma(0,(1-2i)s)+\frac{1+2i}{4i}e^{(1+2i)s}\Gamma(0,(1+2i)s)\\
\end{eqnarray*}
we have
\begin{eqnarray*}
\int_0^\infty\frac{x\sin\pi x}{x^2+2x+5}dx&=&\Im \mathcal{L}\left\{\frac{x}{x^2+2x+5}\right\}\big|_{s=\pi i}\\
&=&\Im\left[\frac{-1+2i}{4i}e^{(1-2i)\pi i}\Gamma(0,(1-2i)\pi i)+\frac{1+2i}{4i}e^{(1+2i)\pi i}\Gamma(0,(1+2i)\pi i)\right]\\
&=&\Im\left[\frac{1-2i}{4i}e^{2\pi}\Gamma(0,(2+i)\pi)-\frac{1+2i}{4i}e^{-2\pi}\Gamma(0,(-2+i)\pi)\right].
\end{eqnarray*}
Here we use
$$\mathcal{L}\big\{\frac{1}{x+a}\big\}=e^{as}\Gamma(0,as).$$
A: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{r = -1 + 2\ic\quad \mbox{and}\quad r^{*}\quad \mbox{are the roots of}\quad
x^{2} + 2x + 5=0\quad}$ such that:

\begin{align}\color{#66f}{\Large I}&=\Im\int_{-\infty}^{\infty}
{x\expo{\ic\pi x} \over\pars{x - r}\pars{x - r^{*}}}\,\dd x
=\Im\bracks{2\pi\ic\,{r\expo{\ic\pi r} \over r - r^{*}}}
=2\pi\,\Im\bracks{\ic\,{r\expo{\ic\pi r} \over 2\ic\,\Im\pars{r}}}
={\pi \over 2}\,\Im\pars{r\expo{\ic\pi r}}
\\[3mm]&={\pi \over 2}\,\Im\bracks{\pars{-1 + 2\ic}\expo{-\ic\pi}\expo{-2\pi}}
=\color{#66f}{\Large -\pi\expo{-2\pi}}
\end{align}

