1 The ear splits sound into frequencies
Whatever is playing reaches you as one wave, a single line of air pressure going up and down. Inside the cochlea, a membrane runs the length of a coiled tube. It is stiff at one end and floppy at the other, so each spot along it shakes most for one frequency, like a keyboard laid out by the sound itself. Pluck a string and watch one line become a row of peaks: the string's fundamental and its overtones, at about 2×, 3×, 4× its frequency.
Try: a pure tone makes one peak. Buzzy and hollow have the same pitch but many peaks, and that pattern is the difference you hear between them, its timbre. Hollow has only the odd ones (×1, ×3, ×5). Near the top, the peaks get closer than the membrane can tell apart and blur together. With the microphone, play your guitar into it.
2 Pitch is something the brain computes
A note's pitch is not simply its lowest frequency. The brain looks for how often the whole wave repeats, and that comes out the same with the fundamental taken away. Phone speakers rely on this: they can't produce real bass, and you hear the bass line anyway.
Try: play all ten, then take away the fundamental while it plays. The sound gets thinner, but the note stays put. "Only 4, 5 and 6" is three high tones a major chord apart, and you still hear the low note none of them is playing.
3 Two notes: where they line up, and where they rub
When two frequencies are close but not equal, they interfere and make a fast wobble the ear hears as roughness. Every note brings its overtones, so two notes are two rows of frequencies. At a fifth or an octave, many overtones land on each other (green) and few are left close enough to rub (red). At a half step, almost every pair rubs.
Try: drag slowly while both notes play and listen for the smooth spots. Then switch to pure tones: the dips at the fifth and the octave disappear, because they come from the overtones lining up. Helmholtz worked this out in the 1860s. Liking the smooth spots is partly learned, though: the Tsimane' in Bolivia, with little exposure to Western music, don't prefer them.
Where this stops
Past these three layers, the brain holds recent notes in memory, builds a sense of key, and predicts what comes next, which is where melody and harmony live. Past that is the question nobody can answer yet: why any of this feels like something at all. Even the second layer is still argued over, as researchers disagree about how much of pitch comes from which spot shakes and how much from timing.