Since $f(x) = \cos^n x$ is even and smooth on $[-\pi,\pi]$ is has a
Fourier cosine series
$f(x) = {c_0 \over 2} + \sum_k c_k \cos (kx)$ where
$c_k = {2 \over \pi} \int_0^\pi \cos^n x \cos(kx) dx$.
Since $\cos^n x = {1 \over 2^n} (e^{ix}+e^{-ix})^n$, we see that for
$k >n$ we have $c_k = 0$.
We see that $a_0 = {c_0 \over 2} = {1 \over \pi} \int_0^\pi \cos^n x dx$.
It should be clear (by integrating over $[0, {\pi \over 2}]$ and $[ {\pi \over 2},1]$ separately)
that for odd $n$ that $a_0 = 0$.
When $n$ is even, combine the binomial theorem with Euler's formula
to get
$a_0 = {1 \over 2^n \pi} \int_0^\pi \binom{n}{k}e^{i(n-2k)x} dx = {1 \over 2^n} \binom{n}{n \over 2}$.