Calculating $\int_0^1 \log(1 - e^{2\pi i z}) dz$ using residues I want to show that for the principal branch of the logarithm,
$$\int_0^1 \log(1 - e^{2\pi i z}) dz = 0.$$
I am supposed to show this by choosing a small $\epsilon$, and integrating over some closed $\Gamma$ that goes from $\epsilon$ to $1 - \epsilon, 1 + i\epsilon, 1 + i/\epsilon, i/\epsilon, i\epsilon$ and back to $\epsilon$ using residues. Since this is a closed chain over a holomorphic function (as $\Re(1 - e^{2\pi i z}) > 0$ for $z\in (0,1)$ or $\Im(z) > 0$),
$$\int_\Gamma \log(1 - e^{2\pi i z}) dz = 0.$$
I guess the trick that I am supposed to use here is to then decompose the other summands into something I can calculate, and then use that $\Gamma$ approaches $[0, 1]$ for sufficiently small $\epsilon$. I just don't see where to go from here. I also don't understand where residues come into play here.
 A: We begin with the improper integral $I$ given by
$$\begin{align}
I&=\int_0^1 \log(1-e^{i2\pi \theta})\,d\theta\\\\
&=\lim_{\varepsilon\to 0^+}\frac1{2\pi}\int_{\varepsilon}^{2\pi-\varepsilon} \log(1-e^{i \theta})\,d\theta\tag1
\end{align}$$
Next, we enforce the substitution $z=e^{i\theta}$ so that $d\theta=\frac{1}{iz}\,dz$.   The integration on the real line in $(1)$ transforms to contour integration in the $z$ plane defined by $|z|=1$, from $\arg(z) =\varepsilon$ to $\arg(z)=2\pi -\varepsilon$.
Then, $(1)$ can be written
$$\bbox[5px,border:2px solid #C0A000]{I=\frac {1}{2\pi i}\lim_{\varepsilon\to 0^+}\int_{e^{i\varepsilon}, |z|=1}^{e^{i(2\pi-\varepsilon )}}\frac{\log(1-z)}{z}\,dz} \tag 2$$
In $(2)$ we tacitly cut the plane along the real axis from $z=1$ to $z=\infty$.

Note that $\frac{\log(1-z)}{z}$ is analytic within and on a closed ("Pac-Man") contour $C$ defined by $z=e^{i\theta}$ for $\varepsilon \le \theta \le 2\pi -\varepsilon$, and $z=1+2\sin(\varepsilon/2) e^{i\nu}$ for $\pi/2 + \varepsilon/2 \le \nu \le 3\pi/2 -\varepsilon/2$.
Then, from Cauchy's Integral Theorem, we have $\oint_C \frac{\log(1-z)}{z}\,dz=0$, which implies
$$\begin{align}
\int_{e^{i\varepsilon}, |z|=1}^{e^{i(2\pi-\varepsilon )}}\frac{\log(1-z)}{z}\,dz&=-\int_{3\pi/2-\varepsilon/2}^{\pi/2+\varepsilon/2} \frac{\log(-2\sin(\varepsilon/2) e^{i\nu})}{1+2\sin(\varepsilon/2) e^{i\nu}}i2\sin(\varepsilon/2) e^{i\nu}d\nu\tag3
\end{align}$$
As $\varepsilon \to 0$ the  term on the right-hand side of $(4)$ approaches $0$ since $\sin(\varepsilon/2)\log (\sin(\varepsilon/2)) \to 0$ as $\epsilon \to 0$.

Putting it all together, letting $\varepsilon\to 0$ in $(2)$ and applying $(3)$ reveals that
$$\bbox[5px,border:2px solid #C0A000]{I=0}$$
