For the vast majority of users, resetting a Mac password is as simple as entering an incorrect password three times in order to trigger the macOS password assistance prompt. As explained by Apple in a support document, the prompt will ask whether you want to reset the password using your Apple ID or want to restart the laptop in order to see the reset options available to you.
The exact option you receive will depend on how you set up your MacBook and which version of macOS it’s running. Typically speaking, most users are going to see the option to reset the password using their Apple ID, which is as simple as logging into the Apple account — though, Apple notes, the MacBook may restart before you’re prompted to enter that information. Depending on your settings, you may also receive a verification code on one of your other devices that you’ll have to enter on the MacBook while resetting the password.
However, if you had previously turned on the FileVault option and set up a recovery key related to it, Apple says you may be prompted to enter that recovery key after restarting the laptop in order to unlock the machine. Once that’s achieved, you’ll then be guided through resetting your password.