Fourier Series from First Principles
The first time I met , in a lecture on simple harmonic motion, I ignored it. Time already seemed enough to describe a signal, so why introduce a second quantity that says the same thing?
Science often advances by having several perspectives on one thing. A pendulum is easier to understand through energy than through forces. What makes time and frequency special is that they are not two approximations of a signal. They are exact and complete descriptions of the same signal, with nothing lost in moving between them. One view can still be far more revealing than the other.
This post derives the first step of that idea, the Fourier series. I'll assume high-school calculus and familiarity with .
Frequency
Here is :

And here is :

The second function changes faster. Its period drops from to , so if we read the horizontal axis as time, its frequency rises from Hz to Hz.
Those numbers are awkward, so for sinusoids we usually work with the angular frequency . The same two signals now have and rad/s, and we can write any sinusoid simply as .
The claim
Joseph Fourier showed that periodic signals can be written as a weighted sum of sinusoids. Strictly, the signal has to be reasonably well behaved, but every signal you'd meet in practice is.
The sinusoids are not arbitrary. If has period , define its fundamental frequency as . Then only integer multiples of are needed:
This makes sense intuitively, since each of those sinusoids repeats every seconds, and so must any sum of them.
A neater form
Euler's formula lets us replace sines and cosines with complex exponentials:
Substituting these in gives
Collecting the terms into a single sum over positive and negative gives the compact form:
where , and for , and .
If you know the , you can rebuild the signal. The remaining question is how to find them from .
Orthogonality
Over an interval of one period, define the inner product of two functions as
Two functions are orthogonal when this is zero. The complex exponentials in equation (1) are orthogonal to one another. For ,
The last step holds because and for every integer . When , the integrand is , so the integral is simply :
Extracting the coefficients
Multiply equation (1) by and integrate over one period. Every term in the sum vanishes except the one with matching index:
which gives us
Equations (1) and (2) are the whole of Fourier series analysis: one builds a signal from its coefficients, and the other recovers the coefficients from the signal.
An example
Sinusoids are simple. This function isn't:

Yet with , which means , it is only a few sinusoids added together:
The figure below builds it up one harmonic at a time, starting from the constant term. Each panel adds the next frequency to the panels above it:

This also shows why the decomposition is useful. Dropping the higher harmonics leaves a smoother approximation of the original signal, and the coefficients tell you how much each frequency matters.
Why this matters for control
Sinusoids have one more property that makes all of this worthwhile. Feed a complex exponential into a linear time-invariant system and the output is the same exponential, multiplied by a single complex number . That is the system's frequency response.
So once a signal is written as a sum of exponentials, the effect of a linear system on it reduces to scaling each term. Differential equations become multiplication, which is the foundation for Bode plots and much of classical control.
Real signals, of course, are rarely periodic, and computers only ever see samples of them. Handling those cases takes us to the Fourier transform and to discrete-time signal processing.
For a visual introduction to the same idea, I recommend 3Blue1Brown's video on the Fourier transform.