Residue theorem Let us say we need to perform the classic integral 
$$
I=\int_{-\infty}^{+\infty}dz \,\frac{e^{itz}}{z^2+1}~,
$$
where $t>0$.
What is normally done is the following. We consider the integral
$$
K=\oint dz \,\frac{e^{itz}}{z^2+1}
$$
with the contour closed on the positive imaginary part of the complex plane. In the area enclosed by the contour, we have the single pole $z_{pole}=+i$ and the rest of the function $f(z)=e^{itz}/(z+i)$ is holomorphic. By using the residue theorem, we can say $K=2\pi if(+i)=e^{-t}/\pi$. The integration over the arc goes to zero since the function $f(z)$ goes to zero faster than $O(1/z)$ for any $z$ in the contour. So, eventually we have $I=K=e^{-t}/\pi$. Fine.
What if I say: we consider the integral
$$
T=\oint dz \,\frac{e^{itz}}{z^2+1} e^{-Im[z]}
$$
with the same contour. Again, in the area enclosed by the contour, we have the single pole $z_{pole}=+i$ and the rest of the function $g(z)=e^{itz}e^{-Im[z]}/(z+i)$ is holomorphic. By using the residue theorem, I should be able to state that $T=2\pi ig(+i)=e^{-t-1}/\pi$. The integration over the arc goes again to zero since $Im[z]>0$ in the arc. Moreover, $Im[z]=0$ on the real axis, so we should have $I=T=e^{-t-1}/\pi$, which is different from before. 
What did I do wrong?

The function $\Im[z]$ is not analytic, since it does not satisfy Cauchy–Riemann equations. Therefore $e^{-\Im[z]}$ is also not analytic. The Cauchy formula cannot be applied and the second method is thus wrong. This solves the discrepancy. Finally, I thank @wisefool for his comment.
