$\sin x + \sin 2x + \sin 3x ...$ = $\cot \frac{1}{2}x$? [duplicate]

If one would formally differentiate the well-known Fourier series $$ \log|\sin(x/2)|=-\log 2-\sum_{n=1}^{+\infty}\frac{\cos nx}{n},\quad (x\neq 2\pi k,\ k\in\mathbf Z), $$ one would get $$ \frac{1}{2}\cot(x/2)=\sum_{n=1}^{+\infty}\sin(nx). $$ Now, as it happens, one cannot just differentiate Fourier series as one wish. Note that, for general $x\in (0,2\pi)$, the terms $\sin(nx)\not\to 0$ (as also mentioned by @Dr.MV in a comment), so the series in the right-hand side does not converge.

One way out of this would be to interpret everything in terms of distributions.