I calculated the complex Fourier Series of
$$c_n= \frac{1}{2\pi}\cdot\int_{-\pi/2}^{\pi/2}cos(x)\cdot e^{-jnx}$$
$$c_0 = \frac{1}{2\pi}\cdot\int_{-\pi/2}^{\pi/2}cos(x)\cdot e^{-j0x} = \frac{1}{2\pi}\cdot\int_{-\pi/2}^{\pi/2}cos(x) = \frac{1}{2\pi}\cdot \Bigg[ sin(x)\Bigg]_{-\pi/2}^{\pi/2} =\frac{1}{\pi}$$
$$c_n= \frac{1}{2\pi}\cdot\int_{-\pi/2}^{\pi/2}cos(x)\cdot e^{-jnx} = \frac{1}{\pi}\cdot\frac{cos(\frac{\pi}{2}n)}{-n^2+1}$$
for $n=2k-1$ $c_n = 0$
for $n = 2k$
$$c_{2k} = \frac{1}{\pi}\cdot\frac{(-1)^k}{-4k^2+1} $$
$$ f(x)= \frac{1}{\pi} + \sum_{k=1}^\infty \frac{1}{\pi}\cdot \frac{(-1)^k}{-(2k)^2+1}\cdot e^{-j2kx} + \sum_{k=1}^\infty \frac{1}{\pi}\cdot\frac{(-1)^k}{-(2k)^2+1}\cdot e^{j2kx} $$
This should be correct. What bothers me is that Mathematica shows this when I expand the sum to the second grade:
$$ \frac{e^{jx}}{4} + \frac{e^{-jx}}{4} + \frac{1}{\pi} + \frac{e^{j2x}}{3\pi} + \frac{e^{-j2x}}{3\pi} $$
I don't know how to get the first two summands because the first two summands (k=1) should be $\frac{e^{j2x}}{3\pi} + \frac{e^{-j2x}}{3\pi}$
Edit: Finally I tried to calculate $c_1$ in the same way as $c_0$ $$ c_1 = \frac{1}{2\pi}\cdot\int_{-\pi/2}^{\pi/2}cos(x)\cdot e^{-jx} = \frac{1}{4} $$ The question is why? I didn't expect any odd coefficients and for $n>1$ it's true. When do I only have to extract $c_0$ and when I need to extract more summands?
Your formula $$c_n=-{1\over\pi}\,{\cos{n\pi\over2}\over n^2-1}\qquad(n\in{\mathbb Z})\tag{1}$$ is true, but some exception handling is necessary: If $n=\pm1$ the expression $(1)$ is undefined. One then can do a special computation for these values of $n$. Another way out is the following: Looking at the defining integral we can see that $c_n$ is actually a continuous function of the real variable $n$. Therefore we can be sure that $$c_1=-{1\over\pi}\>\lim_{n\to 1}\,{\cos{n\pi\over2}\over n^2-1}={1\over\pi}\lim_{n\to1}{{\pi\over2}\sin{n\pi\over2}\over 2n}={1\over4}\ ,$$ by Hôpital's rule; furthermore $c_{-1}=\overline{c_1}={1\over4}$ as well.