Let's calculate the integral $$ \oint_\gamma \frac{e^{ikz}}{z} \, {\rm d} z $$ where $k>0$ and $\gamma$ is the closed contour starting at $-\infty$ to $-\epsilon$, then the $\epsilon$ half-circle clockwise, from $\epsilon$ to $\infty$ and finally the half-circle counter-clockwise back to $-\infty$. The latter vanishes for obvious reasons. Since no pole is enclosed the entire contour integral is $0$. What remains is $$ {\rm PV} \int_{-\infty}^{\infty} \frac{e^{ikz}}{z} \, {\rm d} z - \int_{\gamma_\epsilon} \frac{e^{ikz}}{z} \, {\rm d} z = 0 $$ where $\gamma_\epsilon$ is the $\epsilon$ half-circle counter-clockwise around $z=0$. The result of the ${\rm PV}$ is thus $i\pi$. So far consistent...
Now let's deform the contour at $-\infty$ to bring it to $+\infty$ while encircling the pole at $z=0$. This can be done, because the integral over the big half-circle at $\infty$ vanishes, and no singularities are crossed. The result should therefore be same. However the contour can now be closed at $+\infty$ and the residue-theorem gives $-2\pi i$. How is that?