Consider the integral $\int_{-\infty}^\infty \frac{dz}{z - z_0}$. It has a simple pole at $z = z_0$. Assume $\Im (z_0) < 0$ so the pole is in lower half-plane. Divide
$$ \oint_{C_0} = \int_{-R}^R + \int_{C} $$
where we have enclosed the contour in the upper half-plane as $C = \{ R e^{i\theta} | \theta \in [0, \pi] \}$ is a large semicircle and $C_0 = C \cup [-R, R]$. Then
$$ \oint_{C_0} \frac{dz}{z - z_0} = 0. $$
Also
$$ \int_{C} \frac{dz}{z - z_0} = \begin{bmatrix} z = R e^{i\theta} \end{bmatrix} = \int_0^\pi \frac{R e^{i\theta}i d\theta}{R e^{i\theta} - z_0} = \int_0^\pi \frac{e^{i\theta}i d\theta}{e^{i\theta} - z_0/R}$$
Taking the limit $R \to \infty$,
$$ \int_{C} \frac{dz}{z - z_0} \to \int_0^\pi \frac{e^{i\theta}i d\theta}{e^{i\theta} - (0 + 0i)} = \int_0^\pi i d\theta = i\pi$$
so
$$\int_{-\infty}^\infty \frac{dz}{z - z_0} = - i \pi$$
Is this proof correct? Isn't the integral supposed to be undefined?