Integral $\int_{0}^{2\pi}\log|e^{i \theta}-1|d \theta$ Consider $$\int_{0}^{2\pi}\log|e^{i \theta}-1|d \theta$$
Is it equal to $0$ ? Why ?
Any hint ?
 A: Let's try a result based on Cauchy's theorem.  Let $z=e^{i \theta}$, $d\theta = -i dz/z$.  Also note that $\log{|\zeta|} = \Re{[\log{\zeta}]}$.  Therefore the integral is equal to
$$\Re{\left [ -i \oint_{C} dz \frac{\log{(z-1)}}{z}\right ]}$$
where $C$ is the unit circle with a small semicircular indentation into the unit circle at the branch point $z=1$.  As the contribution to the integral about this branch point is zero, we need not consider this indentation further.  
The integral is equal to $i 2 \pi$ times the residue at the pole $z=0$, or 
$$i 2 \pi (-i) \log{(-1)} = i 2 \pi^2$$
As the original integral is the real part of this, that integral is in fact zero.  Note that we could have used any possible value of $\log{(-1)}$ and come to the same conclusion.
A: $$|e^{ix}-1|=|\cos x+i\sin x-1|=|(\cos x-1)+i\sin x|=\sqrt{(\cos x-1)^2+\sin^2x}=$$
$$=\sqrt{(\underline{\cos}^2x-2\cos x+\underline1)+\underline{\sin}^2x}=\sqrt{2-2\cos x}=\sqrt{4\frac{1-\cos x}2}=2\cdot|\sin\tfrac x2|$$

$$\int_0^{2\pi}\ln\Big(2\cdot|\sin\tfrac x2|\Big)dx=\int_0^{2\pi}\Big(\ln2+\ln|\sin\tfrac x2|\Big)dx=2\pi\ln2+\underbrace{\int_0^{2\pi}\ln|\sin\tfrac x2|dx}_I$$
$$I=2\int_0^\pi\ln|\sin t|dt=2\int_0^\pi\ln(\sin t)dt=2\int_0^1\frac{\ln u}{\sqrt{1-u^2}}du=2\int_0^1\frac{\ln\sqrt y}{\sqrt{1-y}}\cdot\frac{dy}{2\sqrt y}=$$
$$=\frac12\int_0^1(\ln y)\cdot y^{^{-\frac12}}(1-y)^{^{-\frac12}}dy=\frac12\cdot\bigg[\frac d{dn}\int_0^1y^n(1-y)^{^{-\frac12}}dy\bigg]_{n=-\frac12}=\frac{\dfrac d{dn}B\Big(n+1;\ \tfrac12\!\Big)}2$$

$$\frac d{dn}B\Big(n+1,\tfrac12\!\Big)=\frac d{dn}\circ\frac{\Gamma(n+1)\cdot\overbrace{\Gamma\Big(\tfrac12\Big)}^\sqrt\pi}{\Gamma\Big(n+\tfrac32\Big)}=\sqrt\pi\cdot\bigg[\frac{\Gamma'(n+1)}{\Gamma\Big(n+\frac32\Big)}-\frac{\Gamma(n+1)\Gamma'\Big(n+\frac32\Big)}{\Gamma^2\Big(n+\frac32\Big)}\bigg]$$

$$\Gamma(m+1)=m!\quad,\quad n=-\frac12:\quad I=\frac{\sqrt\pi}2\cdot\bigg[\Gamma'\Big(\tfrac12\Big)-\sqrt\pi\cdot\Gamma'(1)\bigg];\quad\Gamma'(m)=H_{_{m-1}}-\gamma$$ where $H_m=\displaystyle\sum_{k=1}^m\frac1k=\int_0^1\frac{1-x^m}{1-x\quad}dx$ is the m$^\text{th}$ harmonic number and $\gamma$ is Euler-Mascheroni's constant.

$$H_{_{-\frac12}}=\int_0^1\frac{1-x^{^{-\frac12}}}{1-x\quad}dx=2\int_0^1\frac{1-t^{^{-1}}}{1-t^2\ }t\cdot dt=2\int_0^1\frac{t-1}{1-t^2}dt=-2\int_0^1\frac{dt}{1+t}=$$
$=-2\ln(1+t)|_0^1=-2\ln2.\quad$ Also, $H_0=0.\quad$ Putting it all together, we (finally!) arrive at the 
$\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad$ desired result.
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\on}[1]{\operatorname{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
$\ds{\bbox[5px,#ffd]{}}$

\begin{align}
&\bbox[5px,#ffd]{\int_{0}^{2\pi}
\ln\pars{\verts{\expo{\ic\theta} - 1}\dd\theta}} =
2\,\Re\int_{0}^{2\pi}
\ln\pars{\expo{\ic\theta} - 1}\dd\theta
\\[5mm] = &\
2\,\Re\oint_{\verts{z}\ =\ 1}\,\,
\ln\pars{z - 1}{\dd z \over \ic z} =
2\,\Im\oint_{\verts{z}\ =\ 1}\,\,
{\ln\pars{z - 1} \over z}\,\dd z
\\[5mm] \stackrel{z\ \mapsto\ z - 1}{=}\,\,\,\,\,&
2\,\Im\oint_{\verts{z + 1}\ =\ 1}\,\,
{\ln\pars{z} \over z + 1}\,\dd z
\end{align}
I'll choose the $\ds{\ln}$-branch cut
$$
\ln\pars{z} = \ln\pars{\verts{z}} +
\ic\arg\pars{z}\,,\quad
0 < \arg\pars{z} < 2\pi\,,\quad z \not= 0
$$
Then $\ds{\pars{~\mbox{with an}\ indent\ \mbox{around the origin}~}}$,
\begin{align}
&\bbox[5px,#ffd]{\int_{0}^{2\pi}
\ln\pars{\verts{\expo{\ic\theta} - 1}\dd\theta}}
\\ = &\ \
\overbrace{2\,\Im\braces{2\pi\ic\bracks{\ln\pars{\verts{-1}} + \ic\pi}}}^{\ds{=\ 0}}\ -\
\overbrace{2\,\Im\lim_{\epsilon \to 0^{+}}\,\,
\int_{2\pi}^{0}\bracks{\ln\pars{\epsilon} + \ic\theta}
\epsilon\expo{\ic\theta}\ic\,\dd\theta}^{\ds{=\ 0}}
\\[5mm] = & \ \bbx{0} \\ &
\end{align}
