While i have been trying to solve the integral $ \int_0^{\pi/2} x\cot x \, \mathrm{d}x $ i have noticed that by trying integrating by parts using $u = x$ and $\mathrm{d}v = \cot x \, \mathrm{d}x$, i get that:
$$ \int_0^{\pi/2} x\cot x \, \mathrm{d}x = x\ln\sin x\Big|_0^{\pi/2} - \int_0^{\pi/2} \ln\sin x\,\mathrm{d}x $$
Plugging the first integral in Wolfram Alpha and after that the resulting integral in the right hand side i noticed that they have the same value! So the evaluation of $u\cdot v$ from $0$ to $\pi/2$ must be $0$, but how is this possible? I mean $\sin 0= 0$ and $\ln 0= -\infty$, so, how is that the term $x\sin x\Big|_0^{\pi/2}$ can be $0$? Or how am i wrong?
Ps: I am trying to integrate by parts first because i am trying to solve the integral by differentiation under the integral sign, if you have any suggestions for this i would also appreciate it!
For your main concern, it's been in the comments but I'll copy it again into the answer, we have
$$\lim_{x\to 0^+}x\ln(\sin x)=0$$
by L'Hospital's rule, for example. Therefore it does hold that $$x\ln(\sin x)\vert_{0}^{\pi/2}=0-0=0$$
I believe there are sources online that shows you how to do this integral (maybe not MSE, but somewhere), but I will try to answer it using Leibniz's rule as you specifically required. Consider for $0\le a\le 1$, $$I(a)=\int_0^{\frac{\pi}{2}}\arctan\left(a\tan x\right)\cdot \cot x\,dx$$ Then \begin{align*} I'(a)&=\int_0^{\frac{\pi}{2}}\frac{\tan x}{a^2\tan^2 x+1}\cdot \cot x\,dx\\ &=\int_0^{\frac{\pi}{2}}\frac{1}{a^2\tan^2 x+1}\,dx\quad\left[\text{let}\ t=\tan x\right]\\ &=\int_0^\infty\frac{1}{a^2t^2+1}\cdot\frac{dt}{t^2+1}\quad\left[\text{just ask Wolfram}\right]\\ &=\frac{\pi}{2\left(a+1\right)} \end{align*} Thus we conclude that $I(a)=\frac{\pi}{2}\ln\left(a+1\right)+C$ where $I(0)=0$, so that $$I(1)=\int_0^{\frac{\pi}{2}}x\cot x\,dx=\frac{\pi}{2}\ln(2)$$ as desired.