Computing an integral using residues I am trying to find an integral:
$$\int_{-\infty}^{+\infty}\frac{e^{-\sqrt{(x^2 + 1)}}}{(x^2 + 1)^2}\,\mathrm dx$$
I went about applying contour integral over a semicircle with diameter along $ x = +\infty$ to  $- \infty $ enclosing the pole at  $x = +i $.  The residue is $(-i/2)$ as shown here.
So the integral should be $(2\pi i)\times (-i/2)=\pi$
However since it is a well behaved function if I do a quick numerical integration in Mathematica it is giving me a value of $0.475$
A plot confirms that the function converges very fast.

Mathematica code:
NIntegrate[  E^{- Sqrt[1 + y^2]}/(1 + y^2)^2, {y, -1000, 1000}]

What am I doing wrong?
Many thanks!
 A: The integral cannot be done by simply calculating residues since the function
$$f(z) = \frac{e^{-\sqrt{z^2 + 1}}}{(z^2 + 1)^2}$$
has poles and branch points at $z=\pm i$.
Here we analyze the integral using complex methods, properly taking the branch cut into account.
The development, and not the result (which depends on another difficult integral), is the point of this answer. 
Consider
$$I(a) = \int_{-\infty}^{\infty}
\frac{e^{-\sqrt{x^2 + a^2}}}{(x^2 + 1)^2}\, dx$$
where $a>1$.
In the spirit of the question, we have separated the poles and branch points. 
We let the branch cuts lie on the imaginary axis from $i a$ to $i\infty$ (and $-i a$ to $-i\infty$).
Thus,
$I(a) = \sum_{i=1}^6 I_i$, where
$$I_i = \int_{\Gamma_i}
\frac{e^{-\sqrt{z^2 + a^2}}}{(z^2 + 1)^2}\, dz,$$
where the $\Gamma_i$ are defined in the figure below.
One can show that $I_1,I_5\rightarrow 0$ as $R\rightarrow\infty$, where $R$ is the radius of the circular arc.
The residue can be found using standard methods.
Let
$$g(z) = \frac{e^{-\sqrt{z^2 + a^2}}}{(z^2 + 1)^2}.$$
We find
\begin{align*}
I_6 &= 2\pi i\,\mathrm{Res}_{z=i}g(z) \\
&= 2\pi i \left.\frac{d}{dz} \frac{e^{-\sqrt{z^2 + a^2}}}{(z+i)^2}\right|_{z=i} \\
&= \frac{\pi}{2}\left(1-\frac{1}{\sqrt{a^2-1}}\right)e^{-\sqrt{a^2-1}}.
\end{align*}
We parametrize the remaining integrals as follows: 
\begin{align*}
I_2:\quad & z = i a+ i t - \varepsilon, & t:\infty\rightarrow 0 \\
I_3:\quad & z = i a + \varepsilon e^{i\theta},  & \theta:\pi\rightarrow 2\pi \\
I_4:\quad & z = i a+ i t + \varepsilon, & t:\infty\rightarrow 0.
\end{align*}
One finds that $I_3 \rightarrow 0$ as $\varepsilon\rightarrow 0$.
$I_2$ and $I_4$ may be combined, with the result
\begin{align*}
I_2 + I_4 &= 2\int_0^\infty \frac{\sin\sqrt{t(t+2a)}}{((t+a)^2-1)^2}dt \\
&= 2\int_a^\infty \frac{\sin\sqrt{u^2-a^2}}{(u^2-1)^2}du.
    & (\textrm{Let }t=u-a.)
\end{align*}
Thus,
\begin{align*}
I(a) 
&= \frac{\pi}{2}\left(1-\frac{1}{\sqrt{a^2-1}}\right)e^{-\sqrt{a^2-1}}
+ 2\int_a^\infty \frac{\sin\sqrt{u^2-a^2}}{(u^2-1)^2}dt. 
\end{align*}
Both terms diverge as $a\to 1$.
The divergent contributions can be shown to cancel leaving a finite part, the value of the original integral.
Aside: Note that if we let $x = \tan t$ we find the original integral is 
$$2\int_0^{\pi/2}e^{-\sec t}\cos^2 t\,dt.$$ 

Figure 1. Definition of $\Gamma_i$.
