<s>[INST] $\int_0^{2\pi} \sqrt{1-\cos(x)}\,dx = 4\sqrt{2}$. Why? According to the textbook, and Wolfram Alpha the above is correct.
Here is the step by step procedure from Wolfram Alpha for evaluating the indefinite integral:

Take the integral: $$\int\sqrt{1-\cos(x)}\,dx$$ For the integrand $\sqrt{1-\cos(x)}$, substitute $u=1-\cos(x)$ and $du=\sin(x)\,dx$: $$=\int-\frac{1}{\sqrt{2-u}}\,du$$ Factor out constants: $$=-\int\frac{1}{\sqrt{2-u}}\,du$$ For the integrand $1/\sqrt{2-u}$, substitute $s=2-u$ and $ds=-du$: $$=\int\frac{1}{\sqrt{s}}\,ds$$ The integral of $1/\sqrt{s}$ is $2\sqrt{s}$: $$=2\sqrt{s}+\text{constant}$$ Substitute back for $s=2-u$: $$=2\sqrt{2-u}+\text{constant}$$ Substitute back for $u=1-\cos(x)$: $$=2\sqrt{\cos(x)+1}+\text{constant}$$ Which is equivalent for restricted $x$ values to: $$\boxed{=-2\sqrt{1-\cos(x)}\cot\big(\frac{x}{2}\big)+\text{constant}}$$

I understand up to the below (which is a valid solution to the integral): $$2\sqrt{\cos(x)+1}+\text{constant}$$
However, if you evaluate this at $2\pi$ and $0$, you get the same thing, so the definite integral evaluates to zero.
After, you transform the above to: $$-2\sqrt{1-\cos(x)}\cot\big(\frac{x}{2}\big)+\text{constant}$$
The expression is indeterminate at $2\pi$ and $0$ of the form $0 \times \infty$. So I guess you would set up a limit and then use L'Hospital's rule to evaluate the expression at $2\pi$ and $0$ and get the answer to the definite integral?
In any case, all this seems strange. Why should the definite integral evaluated one way give $0$, and in another way give something else?
 [/INST] Your $u$-substitutions should be injective on their interval of evaluation. Otherwise, you risk running into exactly this sort of issue.
Note that $$\begin{align}|\sin x| &= \sqrt{\sin^2 x}\\ &= \sqrt{1-\cos^2 x}\\ &= \sqrt{1-\cos x}\sqrt{1+\cos x}\\ &=\sqrt{1-\cos x}\sqrt{2-(1-\cos x)},\end{align}$$ so if you want to use $u=1-\cos x$, then $$\frac{du}{dx}=\sin x=\begin{cases}|\sin x|=\sqrt{1-\cos x}\sqrt{2-(1-\cos x)} & 0\le x\le \pi\\-|\sin x|=-\sqrt{1-\cos x}\sqrt{2-(1-\cos x)} & \pi\le x\le2\pi,\end{cases}$$ so $$\begin{align}\int_0^{2\pi}\sqrt{1-\cos x}\,dx &= \int_0^\pi\sqrt{1-\cos x}\,dx+\int_\pi^{2\pi}\sqrt{1-\cos x}\,dx\\ &= \int_0^\pi\frac{|\sin x|}{\sqrt{2-(1-\cos x)}}\,dx+\int_\pi^{2\pi}\frac{|\sin x|}{\sqrt{2-(1-\cos x)}}\,dx\\ &= \int_0^\pi\frac{\sin x\,dx}{\sqrt{2-(1-\cos x)}}-\int_\pi^{2\pi}\frac{\sin x\,dx}{\sqrt{2-(1-\cos x)}}\\ &= \int_0^2\frac{du}{\sqrt{2-u}}-\int_2^0\frac{du}{\sqrt{2-u}}\\ &= 2\int_0^2\frac{du}{\sqrt{2-u}}.\end{align}$$ At that point, we can use that antiderivative, with no need to resubstitute.
Alternately, you could note that $\cos(2\pi-x)=\cos x$, so $$\begin{align}\int_0^{2\pi}\sqrt{1-\cos x}\,dx &= \int_0^\pi\sqrt{1-\cos x}\,dx+\int_\pi^{2\pi}\sqrt{1-\cos x}\,dx\\ &= \int_0^\pi\sqrt{1-\cos x}\,dx+\int_\pi^{2\pi}\sqrt{1-\cos(2\pi-x)}\,dx\\ &= \int_0^\pi\sqrt{1-\cos x}\,dx-\int_{2\pi}^\pi\sqrt{1-\cos(2\pi-x)}\,dx\\ &= \int_0^\pi\sqrt{1-\cos x}\,dx-\int_0^\pi\sqrt{1-\cos x}\frac{d(2\pi-x)}{dx}\,dx\\ &= 2\int_0^\pi\sqrt{1-\cos x}\,dx,\end{align}$$ at which point you can use your $u$-substitution without fear, since the cosine function is injective on $[0,\pi]$.
</s>