How to evaluate $\sum_{n=-N}^{N} \cos^2 \left(\frac{\pi}{4}n\right)$ Ok I know that the period of this function is $T=8$. I know this can help me in some way, because this means that
$\cos^2 \left( \frac \pi 4 \right) + \cos^2\left(\frac \pi 2 \right) + \cdots + \cos^2(2\pi)=4$ repeats an amount of times I am not really sure about... Is there any method alternative to this one that can help to yield the solution?

HINT:
Note that $$\cos^2(x)=\frac{1+\cos(2x)}{2} \tag 1$$
SPOILER ALERT:  Scroll over the highlighted area to reveal the solution

Using $(1)$ with $x=\pi n/4$ reveals $$\begin{align}\sum_{n=-N}^N \cos^2(\pi n/4)&=\sum_{n=-N}^N\left(\frac{1+\cos(\pi n/2)}{2}\right)\\\\&=(N+1)+\sum_{n=1}^N\cos(\pi n/2)\\\\&=(N+1/2)+\frac12\left(\sin(\pi N/2)+\cos(\pi N/2)\right)\end{align}$$

