Recently I have stumbled upon the following identity: if $n>2$ and $1\leq k\leq\lfloor\frac{n-1}{2}\rfloor$, then $\sum_{l=0}^{n-1}\cos(\frac{2\pi kl}{n})^2=\frac{n}{2}$. There is a lovely proof of this using character theory: let $D_{2n}$ be the dihedral group $\langle r, s\space|\space r^n=1, s^2=1, rs=sr^{-1}\rangle$.
We define the complex representation $\rho_k:D_{2n}\rightarrow\text{GL}_2(\mathbb{C})$ by $s\mapsto\begin{bmatrix}0&1\\1&0\end{bmatrix}$ and $r\mapsto\begin{bmatrix}\cos(\frac{2\pi k}{n})&\sin(\frac{2\pi k}{n})\\-\sin(\frac{2\pi k}{n})&\cos(\frac{2\pi k}{n})\end{bmatrix}$. Clearly $\rho_k$ is irreducible; indeed, given $(z_1, z_2)^{tr}\in\mathbb{C}^2\setminus\{(0,0)^{tr}\}$, because $0<\frac{2\pi k}{n}<\pi$ we have that $\rho_k(r) (z_1, z_2)^{tr}$ and $(z_1, z_2)^{tr}$ are linearly independent, and hence together form a basis for $\mathbb{C}^2$.
Now, let $\langle\cdot|\cdot\rangle$ be the canonical inner product on the vector space of class functions on $D_{2n}$, so that if $\chi_1,\chi_2:D_{2n}\rightarrow\mathbb{C}$ are class functions then $\langle\chi_1|\chi_2\rangle=\frac{1}{|G|}\sum_{g\in D_{2n}}\chi_1(g^{-1})\chi_2(g)$. Recall that the irreducible characters of $D_{2n}$ form an orthonormal basis for the space of class functions, and so in particular we must have $\langle\chi_{\rho_k}|\chi_{\rho_k}\rangle=1$.
The elements of $D_{2n}$ are of course all of the form $r^l$ and $sr^l$, $0\leq l\leq n-1$. We have $\rho_k(r^l)=\begin{bmatrix}\cos(\frac{2\pi kl}{n})&\sin(\frac{2\pi kl}{n})\\-\sin(\frac{2\pi kl}{n})&\cos(\frac{2\pi kl}{n})\end{bmatrix}$, so $\chi_{\rho_k}(r^l)=2\cos(\frac{2\pi kl}{n})$, and likewise $\rho_k(sr^l)=\begin{bmatrix}\sin(\frac{2\pi kl}{n})&\cos(\frac{2\pi kl}{n})\\\cos(\frac{2\pi kl}{n})&-\sin(\frac{2\pi kl}{n})\end{bmatrix}$, so $\chi_{\rho_k}(sr^l)=0$. Because $\cos$ is even we additionally have $\chi_{\rho_k}(r^l)=\chi_{\rho_k}(r^{-l})$.
Combining these facts gives $1=\langle\chi_{\rho_k}|\chi_{\rho_k}\rangle=\frac{1}{|G|}\sum_{g\in D_{2n}}\chi_{\rho_k}(g^{-1})\chi_{\rho_k}(g)=\frac{1}{2n}\sum_{l=0}^{n-1}(2\cos(\frac{2\pi kl}{n}))^2$, whence we obtain the desired equality.
This is in my view quite a nice application of representation theory to an identity not immediately obviously related to it. However, I am wondering whether this is in fact the simplest proof. Can anyone find a more elementary way of deducing of this identity?
Using $\cos^2(x)=\frac{1+2 \cos(2x)}{2}$
You get $$\sum_{l=0}^{n-1}\cos(\frac{2\pi kl}{n})^2=\sum_{l=0}^{n-1}\frac{1+\cos(\frac{4\pi kl}{n})}{2} =\frac{n}{2}+\frac{1}{2}\sum_{l=0}^{n-1}\cos(\frac{4\pi kl}{n})$$
Now $$\sum_{l=0}^{n-1}\cos(\frac{4\pi kl}{n})=0$$ can be proven in many elementary ways. For example use $$\sum_{l=0}^{n-1}\cos(\frac{4\pi kl}{n})= Re( \sum_{l=0}^{n-1}e^{i\frac{4\pi kl}{n} })$$ and the forumal for the sum of a geometric sequence. Or multiply by $\sin(\frac{2\pi kl}{n} )$ and see that you have a telescopic series (and see separately what happens when $\sin(\frac{2\pi kl}{n} )=0$).