TITLE: Sum with sine in denominator
QUESTION [9 upvotes]: Here is some sum that I can guess an answer but somehow lack of nice solution.
$$\displaystyle\sum _{k=0}^{n-2} (-1)^k\frac{1}{\sin\left(\frac{(2k+1)\pi}{4n-2}\right)}=\;?$$

REPLY [9 votes]: As Eric Naslund has noted, we need to show that
$$
\sum_{k=0}^{2n}\frac{(-1)^{k}}{\sin\left(\frac{2k+1}{2n+1}\frac{\pi}{2}\right)}=2n+1,
$$
and this is, in turn, equivalent to
$$
\sum_{k=0}^{2n}\frac{1}{\sin\left(\frac{4k+1}{2n+1}\frac{\pi}{2}\right)}=2n+1.
$$
(Just add $\pi$ to the angles corresponding to odd values of $k$.)
The numbers $z_k = x_k+i y_k = \exp\left(i\frac{4k+1}{2n+1}\frac{\pi}{2}\right)$ for $0\le k \le 2n$
are exactly the distinct roots of the equation $z^{2n+1}=i$,
so what we are summing are thus the reciprocals of the imaginary parts of these roots.
That is, we want to show that
$\sum_{k=0}^{2n} \frac{1}{y_k} = 2n+1$.
Now, if $z=x+iy$ satisfies $z^{2n+1}=i$,
then $x^2+y^2=1$ and $1=\mathrm{Im} (x+iy)^{2n+1} = \sum_{m=0}^n \binom{2n+1}{2m+1} (-1)^m x^{2n-2m} y^{2m+1}$.
Eliminating $x$ from these two equations gives
$$
0= -1 + \sum_{m=0}^n \binom{2n+1}{2m+1} (-1)^m (1-y^2)^{n-m} y^{2m+1} =: p(y).
$$
The right-hand side is a polynomial of degree $2n+1$,
so its roots are exactly the $2n+1$ distinct numbers $y_k$ above (and no others).
EDIT: The numbers $z_0,\dots,z_{2n}$ are evenly distributed on the unit circle; one of them is $(-1)^n i$, and the others appear in pairs $\pm x+iy$.
Thus the $y_k$'s are not all distinct, and the struck out argument above doesn't work. However, it is clear that $\mathrm{Im} (x+iy)^{2n+1} \le 1$ if $x+iy$ lies on the unit circle, so $p(y) \le 0$ for $-1 \le y \le 1$. Therefore, the zeros of $p(y)$ in the open interval $-1 < y < 1$ must be of even multiplicity (since they are local maxima of $p$). We know $n$ distinct such zeros $y=y_k$, and since $p$ has degree $2n+1$ we conclude that these zeros have multiplicity exactly two, and together with the simple zero $y=(-1)^n$ they exhaust the zeros of $p$ (that is, there are no zeros outside of the interval $[-1,1]$. So the zeros of $p$, counted with multiplicity, are exactly $y=y_0,\dots,y_{2n}$.
Since the constant term is $-1$, the coefficient of the $y^1$ term is the sum
of the reciprocals of the roots; this coefficient comes from the term for $m=0$ since all
other terms contribute only higher powers of $y$,
and it equals $\binom{2n+1}{1} = 2n+1$, just as we wanted to show. Done!