How to use Mathematica to do a complex integrate with poles in real axis?
Try
Integrate[Exp[I z] 1/z, {z, -Infinity, Infinity},PrincipalValue -> True]
(*I π*)
One can also consider using the residue theorem. The residue is readily obtained by
Residue[Exp[I z] 1/z, {z, 0}]
returning 1
, which means that the integral is $ \mathrm i \pi $.
If you are sure about your integral's behavior you can try
Integrate[Exp[I z] 1/z, {z, -Infinity, Infinity},
GenerateConditions -> False]
(* I π *)