Integral of $1/z$ over the unit circle

The problem is that the complex logarithm is not continuous on the whole of $\mathbb{C}$. The formula goes

$ \log(z) = \log(|z|) + i \arg(z)$

where you have to define $\alpha < \arg(z) \leq 2 \pi + \alpha$ for some angle $\alpha$. Typically people take the choice $\alpha = 0$ or $\alpha = -\pi$, and a choice of $\alpha$ is called a branch cut, because it defines a ray in the complex plane along which the logarithm is discontinuous.

When you evaluate your integral in terms of the complex logarithm, you have to keep in mind that you are evaluating $\log(1)$ from two different directions in the complex plane, from above the real axis and below it. If you define $\alpha = 0$ as above, then you'll find that the argument of real numbers right above the real axis and right below it differ by $2\pi$, so you get the right answer.


The $\log$ function is only defined for positive real argument, so $t\mapsto \log(e^{it})$ is not defined on $[0,2\pi]$ -- and since it is not defined it is in particular not an antiderivative of $\frac{ie^{iz}}{e^{iz}}$.

One can define a function, usually called $\operatorname{Log}$, that extends $\log$ to all of $\mathbb C\setminus \{0\}$, but then it will not be continuous everywhere -- it will need a "cut" somewhere. This means that even though $\operatorname{Log}(e^{it})$ does exist everywhere on $[0,2\pi]$, it is not continuous (and so not differentiable), and therefore in particular still not an antiderivative of $\frac{ie^{iz}}{e^{iz}}$.