How to understand the mapping between a periodic function to its Fourier coefficients? For a periodic function $f(x)=f(x+T)$, its Fourier transform can be written as an infinite sum:
$$
f(x)=\sum_{-\infty}^{\infty}c_n e^{2\pi i x/T}.
$$
This seems to suggest that the information contained in this periodic function is equivalently contained in this set of coefficients. And the number of the coefficients we need is as many as the number of integers.
For a function that is not periodic
$$
f(x) = \int_{-\infty}^{\infty}f(\xi) e^{-2\pi i \xi x} d \xi,
$$
the number of coefficients we need seems to be as many as the real numbers.
So how should I understand this mapping in turns of mathematical lauguage, for example, what property is common between the integer numbers and a periodic function, and between the real numbers and a non-periodic function?

As Qiaochu Yuan pointed out, both correspondences (circle $\to$ integers and line $\to$ line) are special cases of the Pontryagin duality for locally compact abelian group. 
But perhaps an informal description can be helpful too. The Fourier transform decomposes a function (thought of as a "signal") into waves of different frequencies. In general, a  signal can contain waves of arbitrary frequency; hence, the Fourier transform assigns a number ("amplitude/phase density") to every real number. But a  signal of period $T$ can contains only waves with period $T$, $T/2$, $T/3$, ... This is why   periodic functions  are mapped to a discrete sequence of numbers, describing the amplitude and phase of the aforementioned waves.
