Consider the functions:
e_{k}(x) = \exp(2 \pi i k x)
For functions defined on the interval from n-1/2 to n + 1/2 with n some arbitrary integer, we define the inner product:
\langle f,g\rangle = \int_{n - 1/2}^{n +1/2} f(x)g^{*}(x)dx
Then we see that:
\langle e_k, e_r\rangle = \delta_{k,r}
where \delta_{k,r} is the Kronecker delta, which is zero if the indices are differet and 1 if the indices are equal. This means that the e_k form an orthonormal basis of functions. It can be shown that these functions also form a complete set which then implies that we can expand any function f as:
f(x) = \sum_{k=-\infty}^{\infty} \langle f, e_{k}\rangle e_{k}(x)
[Note that this is completely analogous to how you can expand any vector in terms of basis vectors. If V is a 3d vector and ex, ey and ez are the unit vectors in the x, y, and z, directions, then V = <V,ex>ex +<V,ey> + <V,ez>ez. The inner products <V,ei> are, of course, the components of V in the ith direction.]
At x = n, we have
e_{k}(n)= \exp(2 \pi i k n) = 1,
so we have:
f(n) = \sum_{k=-\infty}^{\infty} \langle f, e_k\rangle =<br />
\sum_{k=-\infty}^{\infty}\int_{n-1/2}^{n+1/2} f(x) \exp(-2 \pi i k x) dx
Now, sum both sides over n from minus infinity to infinity:
\sum_{n=-\infty}^{\infty}f(n) = \sum_{n=-\infty}^{\infty}\sum_{k=-\infty}^{\infty}\int_{n-1/2}^{n+1/2} f(x) \exp(-2 \pi i k x) dx
Interchange the summations over n and k:
\sum_{n=-\infty}^{\infty}f(n) = \sum_{k=-\infty}^{\infty}\sum_{n=-\infty}^{\infty}\int_{n-1/2}^{n+1/2} f(x) \exp(-2 \pi i k x) dx
Summing over n yields
\sum_{n=-\infty}^{\infty}\int_{n-1/2}^{n+1/2}f(x)\exp(-2\pi i k x) dx=\int_{-\infty}^{\infty}f(x)\exp(-2\pi i k x)dx=\hat{f}(k)
So, we have:
\sum_{n=-\infty}^{\infty}f(n)=\sum_{k=-\infty}^{\infty}\hat{f}(k)