The problem is that the Servo library is not installed. Unlike the classic Arduino IDE, which comes with a collection of popular libraries (e.g., Ethernet, Servo, Stepper) pre-installed, Arduino IDE 2.x does not currently come with any libraries. So you must install any libraries your sketches use.
Also unlike the classic Arduino IDE, Arduino IDE 2.x's error message when compilation fails due to a missing library is quite cryptic. I'm hoping that will eventually be fixed to use the more helpful and standard "No such file or directory" error.
Please do this:
Sketch > Include Library > Manage Libraries... - the library manager side bar will now open.
- In the "Filter your search..." field of the Library Manager side bar, type "servo".
- Press the "Enter" key.
- Scroll down through the many search results until you find "Servo by Michael Margolis, Arduino".
- When you hover the mouse pointer over this library entry in the listing, you'll see an "Install" button appear, click on it.
- A dialog will appear to indicate the library is installing. Wait for it to disappear, which means the installation is finished.
Now try compiling your sketch again.