<s>[INST] On the "funny" identity $\tfrac{1}{\sin(2\pi/7)} + \tfrac{1}{\sin(3\pi/7)} = \tfrac{1}{\sin(\pi/7)}$ This equality in the title is one answer in the MSE post Funny Identities. At first, I thought it had to do with $7$ being a Mersenne prime, but a little experimentation with Mathematica's integer relations found,
$$\frac{1}{\sin(2\pi/15)} + \frac{1}{\sin(4\pi/15)} + \frac{1}{\sin(7\pi/15)} = \frac{1}{\sin(\pi/15)}$$
$$\frac{1}{\sin(2\pi/31)} + \frac{1}{\sin(4\pi/31)} + \frac{1}{\sin(8\pi/31)} + \frac{1}{\sin(15\pi/31)} = \frac{1}{\sin(\pi/31)}$$
so the Mersenne number need not be prime. Let $M_n = 2^n-1$. How do we prove that,
$$\frac{1}{\sin(M_{n-1}\pi/M_n)}+\sum_{k=1}^{n-2} \frac{1}{\sin(2^k\pi/M_n)} = \frac{1}{\sin(\pi/M_n)}$$
indeed holds true for all integer $n>2$?
Edit (an hour later):
I just realized that since, for example, $\sin(3\pi/7)=\sin(4\pi/7)$, then the question can be much simplified as,
$$\sum_{k=1}^{n-1} \frac{1}{\sin(2^k\pi/M_n)} \overset{?}{=} \frac{1}{\sin(\pi/M_n)}$$
 [/INST] Let $$\displaystyle S=\sum_{k=1}^{n-1}\csc \left(\frac{2^k \pi}{2^n-1} \right)$$
Using Euler's Formula, we can express this sum in terms of complex numbers.
$$S=\sum_{k=1}^{n-1} \frac{2i}{e^{i 2^k \pi/(2^n-1)}-e^{-i2^k\pi /(2^n-1)}}=2i \sum_{k=1}^{n-1}\frac{e^{i 2^k \pi/(2^n-1)}}{e^{i 2^{k+1}\pi/(2^n-1)}-1}$$
For simplicity, let us assume $x=e^{i\pi/(2^n-1)}$. Then
$$\begin{align*}
S &= 2i\sum_{k=1}^{n-1}\frac{x^{2^k}}{x^{2^{k+1}}-1} \\
&= 2i \sum_{k=1}^{n-1}\frac{(x^{2^k}+1)-1}{(x^{2^k}+1)(x^{2^k}-1)} \\
&= 2i \sum_{k=1}^{n-1}\left( \frac{1}{x^{2^k}-1}-\frac{1}{x^{2^{k+1}}-1}\right)
\end{align*}$$
This is a telescoping sum and it's value is
$$\begin{align*}
S &= 2i \left( \frac{1}{x^2-1}-\frac{1}{x^{2^n}-1}\right)
\end{align*}$$
Back substituting, gives
$$\begin{align*}
S &= 2i \left( \frac{1}{e^{2i\pi/(2^n-1)}-1}-\frac{1}{e^{i 2^n \pi/(2^n-1)}-1}\right) \\
&= 2i \left( \frac{1}{e^{2i\pi/(2^n-1)}-1}+\frac{1}{e^{i\pi/(2^n-1)}+1}\right)\\
&= 2i \frac{e^{i\pi/(2^n-1)}}{e^{2i\pi/(2^n-1)}-1} \\
&= \csc \left( \frac{\pi}{2^n-1}\right)
\end{align*}$$
as desired.
</s>