<s>[INST] Find the Fourier series of the function $f$ 
Define $f (\theta) = (\pi - \theta)^2/4$ for $0\leq \theta \leq 2\pi$  

If $n\neq 0,$
Fourier coefficient of $f$ is:
$$\hat f(n)=\frac 1 {2\pi}\int_0^{2\pi}\frac {(\pi-\theta)^2} 4 e^{-in\theta}d\theta$$
which I have found to be equal to: $$=\frac 1 {8\pi}[\pi^2\frac i n e^{-2\pi i n}+\frac {2\pi}{n^2}e^{-2\pi i n}-\frac {2i}{n^3}e^{-2\pi i n}-\pi^2\frac i n+\frac {2\pi}{n^2}+\frac {2i}{n^3}]\tag {*} $$
Also $e^{-2\pi i n}=\cos{(-2\pi n)}+i\sin{(-2\pi n)}=1$ for any $n\in \{\cdots ,-3,-2,-1,1,2,3,\cdots\}$
This in turn leads me to get $\frac 1 {2n^2}$ in $(*)$  
And when $n=0,$
$$\hat f(0)=\frac 1 {2\pi}\int_0^{2\pi}\frac {(\pi-\theta)^2} 4 d\theta=\frac 1 {2\pi}\frac {(\theta-\pi)^3} {12}|_0^{2\pi}=\frac{\pi^2}{12}$$
So, how do I combine these two results to write in the Fourier series?
It seems that I pretty much there since the result is $$f(\theta) \thicksim \frac{\pi^2}{12}+ \sum_{n=1}^\infty \frac {\cos (n\theta)}{n^2}$$
 [/INST] Expand the answer in terms of exponentials:
$$
 f(\theta) = \frac{\pi^2}{12} + \sum_{n=1}^\infty \frac{\cos(\theta)}{n^2} = 
\frac{\pi^2}{12} + \sum_{n=1}^\infty \frac{e^{in\theta}}{2n^2} + \frac{e^{-in\theta}}{2n^2} = \frac{\pi^2}{12} + \sum_{n=-\infty}^\infty \frac{e^{in\theta}}{2n^2}
$$
which is precisely your solution. Your problem was you were comparing the vector in two different bases.
</s>