# Maple giving nonsensical value for integral

(I think this question is acceptable for this site.)

I ask Maple to evaluate integral(1/(exp(i*t)-z),t,-π,π), and I get [if |z| = 1 then undefined else -(2*π)/z]. I understand the first part, the integrand is singular. However, for |z| ≠ 1, this is an integral of a finite continuous function over a finite closed interval, which must exist and be finite, unlike -(2*π)/0 = -∞ = ∞. Am I just very confused here, or is Maple screwing up? If the first one, how am I confused? If the second one, how should I evaluate the integral?

-

if $w=e^{it}$ is on the unit circle (and $z$ constant), the integral is $$\int_{S^1}\frac{-i dw}{w(w-z)}.$$ you can use partial fractions to get $$-\frac{i}{z}\int_{S^1}\Big(\frac{1}{w-z}-\frac{1}{w}\Big)dw.$$ for $|z|<1$ you get zero (they cancel out) and for $|z|>1$ you get $-2\pi/z$.
here im using the fact (exercise) that $\int dw/w=2\pi i$ if you integrate around the circle once counterclockwise.