Answer: \(\sum_{n=1}^{N}\cos(2n-1)\theta=\frac{\sin(2N\theta)}{2\sin\theta},\qquad \sin\theta\neq0.\)
\(\sum_{n=1}^{N}(2n-1)\sin\left(\frac{(2n-1)\pi}{N}\right)=-N\csc\frac{\pi}{N}.\)
Let \(z=e^{i\theta}\). Then
\(\sum_{n=1}^{N}z^{2n-1}=z+z^3+\cdots+z^{2N-1}.\)
This is a geometric series with first term \(z\) and common ratio \(z^2\), so
\(\sum_{n=1}^{N}z^{2n-1}=\frac{z(1-z^{2N})}{1-z^2}=\frac{z-z^{2N+1}}{1-z^2}.\)
Taking real parts gives
\(\sum_{n=1}^{N}\cos(2n-1)\theta=\Re\left(\frac{z-z^{2N+1}}{1-z^2}\right).\)
After simplifying the real part,
\(\sum_{n=1}^{N}\cos(2n-1)\theta=\frac{\cos(2N-1)\theta-\cos(2N+1)\theta}{2-2\cos2\theta}.\)
Use
\(\cos A-\cos B=-2\sin\frac{A+B}{2}\sin\frac{A-B}{2}.\)
Then
\(\cos(2N-1)\theta-\cos(2N+1)\theta=2\sin(2N\theta)\sin\theta.\)
Also
\(2-2\cos2\theta=4\sin^2\theta.\)
Hence
\(\sum_{n=1}^{N}\cos(2n-1)\theta=\frac{\sin(2N\theta)}{2\sin\theta}.\)
Now differentiate this identity with respect to \(\theta\):
\(-\sum_{n=1}^{N}(2n-1)\sin(2n-1)\theta=N\cos(2N\theta)\csc\theta-\frac12\sin(2N\theta)\csc\theta\cot\theta.\)
Put
\(\theta=\frac{\pi}{N}.\)
Then \(2N\theta=2\pi\), so \(\cos(2N\theta)=1\) and \(\sin(2N\theta)=0\). Therefore
\(-\sum_{n=1}^{N}(2n-1)\sin\left(\frac{(2n-1)\pi}{N}\right)=N\csc\frac{\pi}{N}.\)
Multiplying by \(-1\) gives
\(\sum_{n=1}^{N}(2n-1)\sin\left(\frac{(2n-1)\pi}{N}\right)=-N\csc\frac{\pi}{N}.\)