OK, now we're cooking!
This error is caused by not having the Servo library installed. Because this library comes pre-installed with the classic Arduino IDE, the tutorials you find won't mention anything about needing to install it. But the Arduino IDE 2.x doesn't currently come with any libraries pre-installed. You need to install all of them yourself.
That's very easy to do:
- Select Sketch > Include Library > Manage Libraries... from the Arduino IDE's menus.
- In the "Filter your search..." field, type "servo".
- Scroll down through the list of available libraries until you see "Servo by Michael Margolis, Arduino". Click on it.
- Click the INSTALL button.
- Wait for the installation to finish.
Now you should be able to compile your sketch.