Body
Before booting into recovery mode, check to see if the "erase all contents and settings" option is available. See this article from Apple on how to find this.
If you are able to use this option, you can skip the rest of this article.
If Erase All Contents and Settings is not an option, please continue with these instructions for wiping the machine and reinstalling macOS.
First boot into recovery mode:
Use macOS Recovery on an Intel-based Mac - Apple Support
Use macOS Recovery on a Mac with Apple silicon - Apple Support
Once you boot into recovery mode, proceed with wiping the machine and reinstalling macOS.
If it asks for you to enter a password or recovery key, navigate to the top left of the screen and click "Recovery Assistant," then click "Erase Mac..." then follow the prompts on screen.
Otherwise, continue on.
Once in recovery mode, click Disk Utility
Next, click on Macintosh HD, then click Erase as shown in the photo below:
After that, click “Erase”
Make sure the name is Macintosh HD and the file type is APFS
You will then receive two warnings and will be prompted to restart.
If you are prompted to restart, restart, then repeat the previous steps in disk utility, so that you end up with one drive called "Macintosh HD"
After rebooting, you will return to the Recovery Utilities Screen.
Click “Reinstall macOS"
Click Continue
Click Accept
Click Agree
Select your hard drive then click install
Wait for the installation to complete