I've tried solving it, but I'm not familiar with these kind of progressions and I couldn't get to a result. Also, I've found that the result is just $N/2$, but I don't get why would that be the answer, as it doesn't work for $N=1$ or $N=2$.
Appreciate your help :)
$$\sum_{x=0}^{N-1} \cos^2{\left( \frac{2\pi x}{N} \right)}=\sum_{x=0}^{N-1} \frac{1+\cos\left( \frac{4\pi x}{N}\right)}{2} =\boxed{\frac N2}+\frac12\sum_{x=0}^{N-1}\cos\left( \frac{4\pi x}{N}\right)\tag1$$
Now let compute the latter sum: $$ \sum_{x=0}^{N-1}\cos\left( \frac{4\pi x}{N}\right)= \operatorname{Re}\sum_{x=0}^{N-1}\exp\left( \frac{4\pi x}{N}i\right) =\operatorname{Re}\frac{1-\exp\left(4\pi i\right)}{1-\exp\left(\frac{4\pi}{N}i\right)}=0,\tag2 $$ where we applied the formula for the sum of geometric progression.
Observe that the last equality is valid only for $N>2$, since for $N=1,2$ the denominator degenerates to $0$. More generally $$\sum_{x=0}^{N-1}\exp\left( \frac{2K\pi x}{N}i\right)=0$$ for all $N $ except for the divisors of $K $.