As for the 88 keys, Steinway once produced a grand piano with that many keys and after that other manufacturers copied this and it became the standard.
But before then the Harpsichord was mostly standardized around 60 keys (which is why you can play most of Bach on a 61 key keyboard just fine, and why many organ keyboards are only 61 keys or sometimes even less wide).
There are also larger keyboards, for instance the Bosendorfer Imperial has 97 keys, there is also a 92 key model.
And narrower pianos exist(ed) as well, very rarely you'll see these with anywhere from 64 keys and up.
So it's like many other things in music, a combination of practicality, standardization, fashion, price/economy, but not necessarily any underlying hard logic as to why it should be that way.
> why does piano have 88 keys?
I'm only ok at music theory, so I might get bits somewhat wrong, but the gist is right.
Notes with wavelengths that are integer multiples/fractions of each other sound the same. 440 Hz sounds similar to 220 Hz and 880 Hz (and this makes sense if you just look at the waveform), so we give them the same name. Western music slices the range between ω and 2ω into 12 points evenly divided along a log scale (we call this an octave). The log scale means the relationship of nearby notes is always the same; it takes an exponentially growing scale (frequency) and makes it linear.
You said 7 have names, but there are 12 notes in an octave. You'll learn more about that difference with scales, but the short answer most western music won't use all 12 notes because, for a given key; a specific subset of 7 sound a lot better together than the others.
88 keys is somewhat arbitrary, and there are pianos with more or less. What's important is how many and which octaves the piano covers.
Why is it called an octave when it has 7 named notes? I guess so we can repeat the first one and drive home the 2ω relationship.
I think it's because of 1-based numbering. Two identical pitches are called a "unison".
"Music theory" is almost always "European academic music jargon and notation patterns" with near-zero theory at all. If you actually want theory, you want something like "Music and Memory: An Introduction" by Bob Snyder which is written for creative multimedia artists and others with no formal music notation training, and it doesn't even ever show notation and never gets into harmony at all, but it explains the rest of the basic perception of music.
1. Watch a lecture series that focuses on listening to music
I have been watching the following lecture series: Listening to Music with Craig Wright. This is provided as a free resource from Yale on YouTube. It will answer pragmatic questions (e.g. why 88 keys) you may have encountered.
2. Learn through workbook exercises
Believe it or not, the keyboard offers a convenient interface to learning music theory. The individual keys fit in your hand. Pressing on them makes a consistent sound. In many ways, you don't have to worry about the logistics of making noise.
With that being said, by using a simple keyboard (e.g. digital), you can start the following workbook series: Basics of Keyboard Theory by Julie McIntosh Johnson. This series is available on Amazon. You can start with BKTPREP (preparatory) or BKT1 (level one).
The idea here is to learn something new, in each lesson, and then test your knowledge by working through the workbook. What this series does is it focuses on the foundations of Music Theory without throwing you deep in the water. Like math, you don't progress unless you understand where you've been.
3. Learn an instrument with a teacher
Having a teacher will help you tremendously. While they may focus your attention on the instrument, they will also introduce you to music that applies what you are learning in theory. As you progress, you will start to identify patterns the composer uses in their music. This in turn will correlate to what you have learned in music theory.
4. Compose your own music
Just like the workbook exercises above, you will understand music more by writing it. Maybe you came up with a catchy tune while fiddling around with your instrument. What other notes would sound good with it? How should this catchy tune start and end? How can we make it sound unexpected or delightful?
Always have a goal in mind when learning music theory. Many times, that will motivate you to progress further.
Ideally you'd do this alongside a teacher or someone who knows more so you can bounce questions and applications off of.
There may be better theory books out now, I haven't kept up.
what do you mean by "the basics"? Every kind of music theory is based around assumptions from elsewhere and prior experience
I'd share with people anything from Bernstein otherwise, but for music theory, these particular lectures are not what I'd recommend sharing.