In some calculation, I encounter an integral of the form
\begin{equation} \int_{-\infty}^\infty \text dz\ \frac{1}{z-i\varepsilon}e^{- a z^2+i b z}, \end{equation} where $a>0$ and $b$ are some real constants.
Here is what I've tried so far. I thought to have a clever trick up my sleeve. Namely, since $z$ is real, one can rewrite $z^2=|z|^2$, and do the integral over a contour in the complex plane. The contour is the real line and a semi-cirle 'at infinity'. The integral over this semi-circle would be zero. So: \begin{equation} \int_{-\infty}^\infty \text dz\ \frac{1}{z-i\varepsilon}e^{- a z^2+i b z}=\oint_C \text dz\ \frac{1}{z-i\varepsilon}e^{- a |z|^2+i b z}\overset{?}{=}2\pi i \ \underset{z=i\varepsilon} {\text{Res}}\ \frac{1}{z-i\varepsilon}e^{- a |z|^2+i b z}. \end{equation} However, this does not agree with the numerical solution for the integral (where I pick some $a$ and $b$ randomly).
Now the quastion is: why does this not work, and what $is$ the correct solution?
$I = \int_{-\infty}^\infty \text dz\ \frac{1}{z-i\varepsilon}e^{- a z^2+i b z} = \int_{-\infty}^\infty \text dz\ \frac{1}{z-i\varepsilon}e^{- a z^2+i b (z - i\varepsilon +i\varepsilon)} = e^{-b\varepsilon}\int_{-\infty}^\infty \text dz\ \frac{1}{z-i\varepsilon}e^{- a z^2+i b (z - i\varepsilon)}$, that is
$$e^{b\varepsilon}I = \int_{-\infty}^\infty \text dz\ \frac{1}{z-i\varepsilon}e^{- a z^2+i b (z - i\varepsilon)}$$ and $$\frac{d}{db}(e^{b\varepsilon}I) =i\,e^{b\varepsilon}\int_{-\infty}^\infty \text dz\ e^{- a z^2+i b z}$$ $\ \ \ \ \ \ $ Can you take it from here?