prove $\sum_{k=1}^n(-1)^{k+1}\cos^{2n+1}\left(\dfrac{k\pi}{2n+1}\right)=\frac{1}{2}-\frac{2n+1}{2^{2n+1}}$ Today I found the identity : $$\sum_{k=1}^n(-1)^{k+1}\cos^{2n+1}\left(\dfrac{k\pi}{2n+1}\right)=\frac{1}{2}-\frac{2n+1}{2^{2n+1}}$$.
How to prove or disprove this?
Thank you.
 A: Hint : $$\cos^{2n+1}\left(\dfrac{k\pi}{2n+1}\right)=\frac{1}{2^{2n+1}}(e^{\frac{ik\pi}{2n+1}}+e^{-\frac{ik\pi}{2n+1}})^{2n+1}.$$ Then use the binomial theorem and switch the sums to get $$\frac{1}{2^{2n+1}}\sum_{j=0}^{2n+1}\sum_{k=1}^n (-1)^{k+1} \binom{2n+1}{j}e^{\frac{ikj\pi}{2n+1}}e^{-\frac{ik\pi(2n+1-j)}{2n+1}}$$ which is equal to $$-\frac{1}{2^{2n+1}}\sum_{j=0}^{2n+1} \binom{2n+1}{j} \sum_{k=1}^n e^{\frac{2ikj\pi}{2n+1}}.$$
A: Now I can solve it.
Let $a=e^{\frac{\pi}{2n+1}i}$. We will get $$\sum_{k=1}^n(-1)^k\cos^{2n+1}\left(\frac{k\pi}{2n+1}\right)=\frac{1}{2^{2n+1}}\sum_{k=1}^n(-1)^k(a^k+a^{-k})^{2n+1}$$
Using the binomial theorem and switching the sums yield
$$\frac{1}{2^{2n+1}}\sum_{k=1}^n(-1)^k(a^k+a^{-k})^{2n+1}=\frac{1}{2^{2n+1}}\sum_{r=0}^{2n+1}\binom{2n+1}{r}\sum_{k=1}^na^{2rk}$$.
For $r=0$ and $r=2n+1$, we have $\sum_{k=1}^na^{2rk}=n$ because $a^{2r}=1$. 
For $r\in\{1,2,...,2n\}$, we have $\sum_{k=1}^na^{2rk}=\frac{a^{2r}(a^{2nr}-1)}{a^{2r}-1}$.
Hence, 
$$\sum_{r=0}^{2n+1}\binom{2n+1}{r}\sum_{k=1}^na^{2rk}=2n+K$$
,Where $K=\sum_{r=1}^{2n}\binom{2n+1}{r}\frac{a^{2r}(a^{2nr}-1)}{a^{2r}-1}$.
Let $A_r=\binom{2n+1}{r}\frac{a^{2r}(a^{2nr}-1)}{a^{2r}-1}$. We obtain $A_{2n+1-r}=\binom{2n+1}{2n+1-r}\frac{a^{2n+1-r}((-1)^{2n+1-r}-a^{2n+1-r})}{a^{2({2n+1-r})}-1}$.
Since $a^{2n+1}=-1$, we can simplify $A_r=\binom{2n+1}{r}\frac{(-a)^r-a^{2r}}{a^{2r}-1}$ and  $A_{2n+1-r}=\binom{2n+1}{r}\frac{1-(-a)^r}{a^{2r}-1}$.
We see that $A_{r}+A_{2n+1-r}=-\binom{2n+1}{r}$.
Since $K =\sum_{r=1}^{2n}A_r=\sum_{r=1}^{2n}A_{2n+1-r}$, 
we obtain $K=\frac{1}{2}\sum_{r=1}^{2n}(A_{r}+A_{2n+1-r})=-\frac{1}{2}\sum_{r=1}^{2n}\binom{2n+1}{r}=-\frac{1}{2}(2^{2n+1}-2)=1-4^n$
Hence, $$\sum_{k=1}^n(-1)^k\cos^{2n+1}\left(\frac{k\pi}{2n+1}\right)=\frac{1}{2^{2n+1}}(2n+K)=\frac{2n+1}{2^{2n+1}}-\frac{1}{2}$$
