Evaluating $\cos\frac{k\pi}{p}+\cos\frac{2k\pi}{p}+\cos\frac{3k\pi}{p}+\dots +\cos\frac{2\frac{(p - 1)}{2}k\pi}{p}$ 
If $p$ is a prime then what is the value of the series 
  $$\cos\frac{2\pi}{p}+\cos\frac{4\pi}{p}+\cos\frac{6\pi}{p}+\dots +\cos\frac{(p - 1)\pi}{p}$$ In general what is the value of the following series
  $$\cos\frac{k\pi}{p}+\cos\frac{2k\pi}{p}+\cos\frac{3k\pi}{p}+\dots +\cos\frac{2\frac{(p - 1)}{2}k\pi}{p}$$ 


In general, if $n$ is an odd positive integer, 
$$\sum_{k=0}^{(n-1)/2}\cos(2\pi k/n)=\Re
\sum_{k=0}^{(n-1)/2}\exp(2\pi i k/n)
=\Re\frac{e^{2\pi i (n-1)/2n}-1}{e^{2\pi i/n}-1}
=\Re\frac{-e^{\pi i/n}-1}{e^{2\pi i/n}-1}
=\frac12$$
so
$$\sum_{k=1}^{n-1}\cos(2\pi k/n)=\frac12-1=\frac12.$$
The second sum can be handled similarly.
