Note: The following answers the question before it was edited and changed.
Let $z = e^{ix}$ (so $|z|=1$) then
$$
f(x) = \frac{1-a^2}{(1-a z)(1-a z^{-1})} = \frac{a}{z-a} + \frac{1}{1- a z}.
$$
As a function of $z$ this has the following Laurent expansion on the unit circle:
$$
\frac{a}{z}\sum_{k=0}^{\infty} \frac{a^k}{z^k} + \sum_{k=0}^{\infty} a^k z^k = 1 + \sum_{k=1}^{\infty}a^k(z^k + z^{-k}) = 1 + 2 \sum_{k=1}^{\infty} a^k \cos(k x)
$$
This gives the Fouries series of $f$ without calculating any integral.
The same can be done for the latest form of $f$.
$$
f(x) = \frac{2-a (z + z^{-1})}{2(1-a z)(1 - a z^{-1})} = \frac{a}{2 (z-a)}+\frac{1}{2 (1 - a z)}+\frac{1}{2}
$$
The Fourier series is now apparent given the previous result:
$$
f(x) = 1 + \sum_{k=1}^{\infty} a^k \cos(k x)
$$