I have found the following formula for the sum of cosines in both here and here.
\begin{align} \sum^n_{l=1} \cos \left(\frac{2 \pi l}{n}\right) = 0 \end{align}
I would like to know what the sum would be if there is a multiplicative factor $k$ in the angle.
\begin{align} \sum^n_{l=1} \cos \left(\frac{2 \pi l k}{n}\right) = ? \end{align}
where, $k$ is a positive integer and $1 \le k \le (n-2)/2 $.
Moreover, what if the interval for $l$ is changed from $[1, n]$ to $[0, l-1]$. So,
\begin{align} \sum^{n-1}_{l=0} \cos \left(\frac{2 \pi l k}{n}\right) = ? \end{align}