I am interested into the following integral
$I = \int_{-\infty}^{+\infty} \frac{f(z)}{z-z_0} dz$
where $f$ is typically a Gaussian function $e^{-z^2}$. I am tempted to simply use Cauchy formula to get
$I = 2\pi i f(z_0) = 2\pi i \ e^{-z_0^2}$
But I am not sure that the contribution of the half circle containing $z_0$ goes to $0$ as the radius of the circle $R$ goes to $+\infty$ and I could not find a description of the analytic properties of the complex Gaussian to justify this integration on the internet. On top of that, Mathematica gives me $0$ as a result too.. Can the integral be carried out like written or is not so simple? Thank you.
We first note that
$$\begin{align} \int_{-\infty}^\infty \frac{e^{-z^2}}{z-z_0}\,dz&=2z_0 \int_0^\infty \frac{e^{-x^2}}{x^2-z_0^2}\,dx\tag1 \end{align}$$
Second, let $I(a)$ be defined as
$$\begin{align} I(a)&=2z_0 \int_0^\infty \frac{e^{-ax^2}}{x^2-z_0^2}\,dx\tag2 \end{align}$$
Observe that $I(1)$ is simply the integral of interest in $(1)$.
Third, differentiate $(2)$ to find
$$\begin{align} I'(a)&=-2z_0 \int_0^\infty \frac{x^2\,e^{-ax^2}}{x^2-z_0^2}\,dx\\\\ &=-2z_0 \int_0^\infty \frac{(x^2-z_0^2+z_0^2)\,e^{-ax^2}}{x^2-z_0^2}\,dx\\\\ &=-2z_0\int_0^\infty e^{-ax^2}\,dx-z_0^2I(a)\\\\ I'(a)+z_0^2I(a)&=-z_0\sqrt{\pi/a}\tag3 \end{align}$$
Now, solving the ODE in $(3)$ for $I(a)$ we find that
$$I(a)=I(0)e^{-az_0^2}-2\sqrt{\pi}e^{-az_0^2}\int_0^{\sqrt{a}z_0}e^{x^2}\,dx\tag4$$
Using the initial condition $I(0)=i\pi\,\text{sgn}\left(\text{Im}\left(z_0\right)\right)$ and setting $a=1$ in $(4)$ yields the coveted result
$$\begin{align} \int_{-\infty}^\infty \frac{e^{-z^2}}{z-z_0}\,dz&=i\pi\,\text{sgn}\left(\text{Im}\left(z_0\right)\right)e^{-z_0^2}-2\sqrt{\pi}e^{-z_0^2}\int_0^{z_0}e^{x^2}\,dx\\\\ &=\bbox[5px,border:2px solid #C0A000]{i\pi\,\text{sgn}\left(\text{Im}\left(z_0\right)\right)e^{-z_0^2}-\pi e^{-z_0^2}\text{erfi}(z_0)}\tag5 \end{align}$$
where $\text{sgn}(x)$ is the Sign Function and $\text{erfi}(z)$ is the Imaginary Error Function.
EXAMPLES:
As an example, if $z_0=2+i5$, the result is $i\pi e^{21-20i}-\pi e^{21-20i} \text{erfi}(2+i5)$, which is verified using Wolfram Alpha (See Here).
And if $z_0=2-i5$ the result is $-i\pi e^{21+20i}-\pi e^{21+20i} \text{erfi}(2-i5)$, which was also verified using Wolfram Alpha.
Thus, we see that the sign of the imaginary part of the answer depends on the sign of $\text{Im}(z_0)$.
Note that if $z_0$ is purely real, we can evaluate $(1)$ as a principal value. Setting $z_0$ to $x_0\in \mathbb{R}$ in $(5)$ shows that
$$\text{PV}\int_{-\infty}^\infty \frac{e^{-z^2}}{z-x_0}\,dz=-\pi e^{-x_0^2}\text{erfi}(x_0)$$