How do you evaluate this trigonometric sum? I have strong reason$^{\dagger}$ to believe that the following equation is true:
$$\sum_{m=0}^{n} \left[\left(e^{i\pi\frac{k+k'}{n}}\right)^m+\left(e^{i\pi\frac{k-k'}{n}}\right)^m+\left(e^{i\pi\frac{-k+k'}{n}}\right)^m+\left(e^{i\pi\frac{-k-k'}{n}}\right)^m\right]=2[1+\cos \left[(k+k')\pi\right]$$
Where $0<k,k'<n$ are positive integers, but with $k\neq k'$ (for simplicity we can take $k>k'$). I have already verified this for various values of  $k$, $k'$, and $n$, but I can't seem to prove it in general. Any suggestions?
$^{\dagger}$I came to this formula by writing out the character orthogonality relation for different 2-dimensional representations of the dicyclic group $Q_{2n}$.
 A: $$
\begin{aligned}
\sum_{m=0}^{n} &\left[\left(e^{i\pi\frac{k+k'}{n}}\right)^m+\left(e^{i\pi\frac{k-k'}{n}}\right)^m+\left(e^{i\pi\frac{-k+k'}{n}}\right)^m+\left(e^{i\pi\frac{-k-k'}{n}}\right)^m\right]\\
&= \sum_{m=0}^{n} \left[\left(e^{i\pi\frac{k+k'}{n}}\right)^m+\left(e^{i\pi\frac{k-k'}{n}}\right)^m\right] + \sum_{m=-n}^{0} \left[\left(e^{i\pi\frac{k+k'}{n}}\right)^m+\left(e^{i\pi\frac{k-k'}{n}}\right)^m\right]\\
&= 2 + \sum_{m=-n}^{n} \left[\left(e^{i\pi\frac{k+k'}{n}}\right)^m+\left(e^{i\pi\frac{k-k'}{n}}\right)^m\right]\\
&= 2 + e^{i\pi(k+k')} + e^{i\pi(k-k')} + \sum_{m=-n}^{n-1} \left[\left(e^{i\pi\frac{k+k'}{n}}\right)^m+\left(e^{i\pi\frac{k-k'}{n}}\right)^m\right]\\
&= 2 + e^{i\pi(k+k')} + e^{i\pi(-k-k')}\\
&\text{(By periodicity of $e$; and note that the sum comes from geometric series)}\\
&= 2(1+\cos(k+k')\pi).
\end{aligned}
$$
A: Using the formula for the sum of a geometric series,
$$
\sum_{m=-n}^{n-1}e^{i\pi\frac knm}=
\left\{\begin{array}{}
\frac{e^{i\pi k}-e^{-i\pi k}}{e^{i\pi\frac kn}-1}=0&\text{if $2n\nmid k$}\\
2n&\text{if $2n\mid k$}
\end{array}\right.
$$
Therefore,
$$
\begin{align}
\sum_{m=0}^n\left[e^{i\pi\frac knm}+e^{-i\pi\frac k nm}\right]
&=\overbrace{\ \ 1\ \ \vphantom{e^{i\pi m}}}^{m=0}+\overbrace{e^{i\pi k}}^{m=n}+\sum_{m=-n}^{n-1}e^{i\pi\frac knm}\\
&=\left\{\begin{array}{}
1+(-1)^k&\text{if $2n\nmid k$}\\
2n+2&\text{if $2n\mid k$}
\end{array}\right.\\[9pt]
&=1+(-1)^k+2n\,[2n\mid k]
\end{align}
$$
using Iverson Brackets.
Thus,
$$
\begin{align}
&\sum_{m=0}^n\left[e^{i\pi\frac{k+k'}nm}+e^{-i\pi\frac{k+k'}nm}+e^{i\pi\frac{k-k'}nm}+e^{-i\pi\frac{k-k'}nm}\right]\\
&=2+(-1)^{k+k'}+(-1)^{k-k'}+2n\,[2n\mid k+k']+2n\,[2n\mid k-k']\\
&=2+2\cos((k+k')\pi)+2n\,[2n\mid k+k']+2n\,[2n\mid k-k']
\end{align}
$$
So the formula in the question will fail only in the case where $2n\mid k+k'$ or $2n\mid k-k'$. However, if $0\lt k,k'\lt n$ and $k\ne k'$, these divisibility conditions cannot be satisfied.
