When two notes are almost in tune then we hear a warble in the sound. The volume gets loud and soft a few times a second. It changes slower as the two notes get closer in tuning. We can use this effect to tune by ear (link).
Why does this happen?
The easiest way to see why this happens is to think of a note as a sine wave. Which you can think of a plot of air pressure vs time. This change in pressure moves your ear drum and we hear it as a tone.
When a second instrument plays a tone. It has its own sine wave, but is at a slightly different frequency.
The sound we hear is the sum of these two plots.
They don’t look too different when zoomed in, but when we zoom out there is an interesting effect.
The waveform has a slow change in height. This is what we hear as a change in volume that is a beat. When you do the maths, the frequency of the beats is actually the same as the difference in the frequency of the two notes.
Listening for the beats help you work out when you are in tune.