The cotangent function is usually integrated by simple substitution.
$$\tag{1} \int \cot(x)\,dx = \int \frac{\cos x}{\sin x}\,dx$$
Seting $u=\sin x$, we get $du = \cos x \, dx$. Plugging this in, we get an integral, which we can easily solve. Substituting $u$ back, we get a solution:
$$\tag{2} \int \frac{1}{u}\,du = \ln|u| + C = \ln|\sin x| + C$$
However, we get a seemingly different result if we choose a different $u$. If we set $u = \cos x$ and plug $du = -\sin x\,dx$ into the original expression $(3)$, we get:
$$\tag{3.1} -\int \frac{u}{1-u^2}\,du$$
With another substitution, setting $v = 1 - u^2$ and plugging in $dv = -2u\,du$, we can solve the integral. Pluging $u$ and $v$ back, we get a solution.
$$\tag{3.1} \int \frac{1}{2v}\,dv = \frac{\ln|v|}{2} + C = \frac{\ln|\sin^2x|}{2} + C$$
The two solutions are equivalent, even according to Wolfram Alpha, yet I find it difficult to see how. I would be most thankful if someone could show their equality $(4)$.
$$\tag{4} \ln|\sin x| = \frac{\ln|\sin^2x|}{2} + C$$
Thanks to the comments by Ak19 and Peter Foreman, I now see how the equality holds. We just rewrite the second solution (without the constant) like so $(5)$.
$$\tag{5} \frac{\ln|\sin^2x|}{2} = \frac{\ln|{e^{2\ln|\sin x|}}|}{2} = \ln|e^{\ln|\sin x|}| = \ln|\sin x|$$
Yes, both the results obtained are the same $$\frac{\ln|\sin^2 x|}{2}$$ $$=\frac{\ln|\sin x|^2}{2}$$ $$=\frac{2\ln|\sin x|}{2}$$ $$=\ln|\sin x|$$