Animation for Fourier series explanation https://www.youtube.com/watch?v=k8FXF1KjzY0
Can someone explain what is represented by the patterns traced out by the circles in the left part of this animation? If these circles can be thought of as lying in the complex plane they are represented by $e^{i\omega_0kt}$ for different $k$. The Fourier coefficient $\hat{f}(k)$ of the function being expanded should be a complex number specifying the magnitude and phase of these circles, in order for their sum to approach this function. So shouldn't these circles be drawing the function? Why is the function the projection on the imaginary axis? This is like ignoring all the cosine terms no? But why do that and why is the sum of the circles not $f$? 
If the addition of the circles is the way to represent $f$ using its Fourier decomposition shouldn't the complex value that results from this addition at each point in time represent $f$ at that time? For another example, youtube.com/watch?v=8Q0NxFt-s7Y what is happening in this animation? Why not take only y here?
 A: The rotating circles at left are indeed giving you $\cos(x)$, $\cos(2x)$, $\cos(3x)$ and so on. The first circle rotates at a constant rate. The end of the clock hand has an $x$ coordinate of $\sin(t)$ (we don't use the $x$ coordinate) and a $y$ coordinate of $\cos(t)$. The second circle rotates at three times that rate, and has a $x$ coordinate of $\sin(3t)$ and a $y$ coordinate of $\cos(3t)$. The third has an $x$ coordinate of $sin(5t)$ and a $y$ coordinate of $\cos(5t)$. Stacking the circles as they are arranged has the effect of summing the $y$'s.
The vertical line to the right is sweeping at a constant rate, so 
$x=t$. Replace $t$ with $x$ in all the cosines.
The animation is doing a real-valued Fourier transform as a sum of cosines. Recall that $\cos(x) = \frac{1}{2}e^{ix} +\frac{1}{2}e^{-ix}$, so if you're not yet comfortable with the real Fourier transformation, you can think of it as a complex transform that's symmetric about the origin.
If you had an infinite number of circles, the sum would indeed be that square wave. The animation is showing that as you add cosine terms, the sum approaches the square wave in the limit.
Of course, this is showing the result of the transformation, not the process that obtained it. You're not seeing the computation of $F(n) = \int_0^\pi f(x)\cos n \pi x ~ dx$ that derives the coefficients, you're just seeing the summation of the series that results from it.
A: What is being illustrated is behavior in time of a system of epicycles. This is, the equation $x(t)+iy(t)=a_1e^{it}+a_2e^{2it}+\dots$ for some constants $a_1,a_2,\dots$ is a system. Its graph is a curve in a 3 dimensional  $(x,y,t)$ space. The projection onto $(x,y)$ is the left side of the animation. The projection onto $(y,t)$ is the right side. We are seeing two projections of the "world line" of a moving system of circle epicycles.
A: The Fourier series for a square wave that is $-1$ for $-\pi < t < 0$ and is $1$ for $0 < t < \pi$ is a sine series. This sine series in $t$ is the imaginary part of an exponential series, which is what they are plotting. So, they consider only the sum of the exponentials with positive imaginary argument $e^{int}$, and they look only at the vertical component. They add the exponentials as you would add vectors in $\mathbb{R}^2$, which is the same as complex addition. Then they plot the height, which is the imaginary component, as a function of $t$, and that is the graph on the right. But I guess they are plotting the graph on the right backwards in time, because the earlier values of time are to the right.
