Let's take a look at a Fourier Transform of a wave using Python: fftp.py
This code calculates fourier transform using scipy and plots it using matplotlib. The output result for an audio of me just singing one consecutive note is here:
The axis from 0.0 to 1.0 is the magnitude, the axis from 0 to 3000 is the frequency. The most prominent notes are labeled under the frequency they map to. The note mapping to frequency list
The logic is that, the dominant frequency (the one with highest amplitude) IS the F0, a.k.a. as the root note. The other notes and frequencies are overtones and noise that is introduced by a lot of factors. Where exactly overtones come from is a bit of a boring thing to cover, but if you wish - there's a lot of research papers on the matter :)
Please take a notice of this:
The highest peak is a bit below the G4 note, however since it's still a valid frequency - it IS considered the F0 for the wave, even though it does not map to the standard 12-note scale system. The note labels are used for demonstration purposes.
Thanks to Sam Gallagher and their phenomenal article for the code base.