First, instead of cos and sin, define the Fourier series using complex exponential. Then, let $f(z)$ be a complex analytic function in the complex plane, with period $1$.
Then write the substitution $q = e^{2\pi i z}$. This way the analytic function $f$ actually becomes a meromorphic function of $q$ around zero, and $z = i \infty$ corresponds to $q = 0$. The Fourier expansion of $f(z)$ is then nothing but the Laurent expansion of $f(q)$ at $q = 0$.