Proving $\sum\limits_{r=1}^n \cot \frac{r\pi}{n+1}=0$ using complex numbers

For the first part :

Write $$x^n+x^{n-1}+...+x+1 =(x-x_1)(x-x_2)\ldots (x-x_{n})$$

Take log both the sides

$$\log (x^n+x^{n-1}+...+x+1)= \log(x-x_1) +\log(x-x_2)+\ldots +\log(x-x_n)$$ Differentiating w.r.t. $x$, we get

$$\frac{ nx^{n-1}+(n-1)x^{n-2}+\ldots+ 1}{x^n+x^{n-1}+...+x+1}= \frac{1}{x-x_1}+\frac{1}{x-x_2}+\ldots +\frac{1}{x-x_n}$$

Now put $x=1$

$$\frac{(n)+(n-1)+\ldots + 1}{1+1+\ldots +1}=-\left(\frac{1}{x_1-1} + \frac{1}{x_2-1}+...+\frac{1}{x_n-1}\right)$$

$$\color{red}{\boxed{ \frac{1}{x_1-1} + \frac{1}{x_2-1}+...+\frac{1}{x_n-1}=- \frac{n}{2} }}$$


@Jaideep Khare already gave a nice answer to first question, namely he proved that, $$\frac{1}{x_1-1} + \frac{1}{x_2-1}+...+\frac{1}{x_n-1}=- \frac{n}{2}$$ where $x_i$'s satisfy $$\color{red}{\frac{x^{n+1}-1}{x-1}= }x^n+x^{n-1}+...+x+1=0$$

It is easy to check that, $\color{blue}{x_k = e^{\frac{2r\pi}{n+1}}}$ with $0\le k\le n $ is easy to see that, $x_k$'s are the roots of the equation $$\color{red}{\frac{x^{n+1}-1}{x-1} } =x^n+x^{n-1}+...+x+1=0$$

Now using: $\sin x =\frac{e^{ix}-e^{-ix}}{2i}$ and $\cos x =\frac{e^{ix}+e^{-ix}}{2} $ one can check that,

$$\cot x =i\frac{e^{ix}+e^{-ix}}{e^{ix}-e^{-ix}}= i +i \frac{2}{e^{2ix}-1}$$ thus,

$$\color{blue}{\sum_{r=1}^n \cot \frac{r\pi}{n+1} = ni+ 2i\sum_{r=1}^n \frac{1}{\displaystyle{e^{\frac{2r\pi}{n+1}}}-1} = ni+ 2i\sum_{r=1}^n \frac{1}{x_r-1} =0}$$


Let's do it without any tricks using standard results from the usual theory of polynomial equations. If $\alpha$ is a root of $f(x) =0$ then $\beta=\alpha-1$ is a root of $f(x+1)=0$. Thus it follows that $y_{i} =(x_{i} - 1)$ are the roots of equation $$(y+1)^{n}+(y+1)^{n-1}+\dots+(y+1)+1=0$$ ie $$y^{n} +(n+1)y^{n-1}+\dots+(1+2+\cdots+n)y+ (n+1)=0$$ ie $$y^{n} +(n+1)y^{n-1}+\dots+\frac{n(n+1)}{2}y+(n+1)=0$$ Further note that if $\alpha$ is a root of $f(x) =0$ then $\gamma=1/\alpha$ is a root of $x^{n} f(1/x)=0$. And therefore $z_{i} =1/y_{i}=1/(x_{i}-1)$ are the roots of $$(n+1)z^{n}+\frac{n(n+1)}{2}z^{n+1}+\dots+(n+1)z+1=0$$ and hence the sum of its roots is $$-\frac{n(n+1)/2}{n+1}=-\frac{n}{2}$$ which answers your first question.

The answer to your second question is based on the fact that the given equation can be written as $$\frac{x^{n+1}-1}{x-1}=0$$ and the roots of the equation $x^{n+1}-1=0$ are given as $$\cos\left(\frac{2k\pi} {n+1} \right)+i\sin\left(\frac{2k\pi}{n+1}\right), \, k=0,1,2,\dots,n$$ The root $x=1$ corresponds to $k=0$ and hence the roots $x_{k} $ of the original equation are given by $$x_{k} =\cos\left(\frac{2k\pi}{n+1}\right)+i\sin\left(\frac{2k\pi}{n+1}\right), \, k=1,2,\dots,n$$ Further we have $$\frac{1}{x_{k}-1}=-i\cdot\frac{1}{2}\cot\left(\frac{k\pi}{n+1}\right)-\frac{1}{2} $$ Since the sum of these roots is $-n/2$ it follows that $$\sum_{k=1}^{n}\cot\left(\frac{k\pi}{n+1}\right)=0$$