How notes map to frequencies
Equal temperament divides the octave into twelve equal steps. Equal here means equal in ratio rather than equal in Hertz: each semitone multiplies the frequency by the twelfth root of two, roughly . Twelve of those multiplications land exactly on double the starting frequency, which is why an octave up is always twice the Hz and an octave down always half.
That multiplicative behaviour is what makes the arithmetic feel strange at first. Between A3 at 220 Hz and A4 at 440 Hz there are 220 Hz of room. Between A4 and A5 there are 440 Hz. The musical distance is identical, but the frequency distance doubles every time you climb.
To turn a note name into a number, the whole keyboard needs a single index. MIDI numbering provides it: every semitone gets one integer, with A4 fixed at 69 and middle C, C4, at 60. Once a note has a MIDI number, one formula produces its frequency:
The exponent counts semitones away from the reference. Feed it 69 and the exponent is zero, so the answer is the reference itself. Feed it 81, twelve semitones higher, and the exponent is one, so the answer doubles.
The same formula runs in reverse when you have a frequency and want the note, which is exactly what a tuner does several times per second.