Here is a quick tutorial on how to wipe out everything from your Macbook and restore it to the factory settings.
To start, make sure that all of your files are backed up elsewhere. When you revert your MacBook Pro back to factory settings, you will also be wiping out all of the data on your hard drive. If there is anything you want to keep, take the time to move it all onto an external hard drive.
Once your files are backed up, shut down your MacBook Pro. Plug it into the AC adapter, and then boot it back up. Finally, press and hold “Command-R” (the “Command” and “R” keys at the same time) to start the restore process. Hold these keys until the Apple logo appears on the screen, and then release them. You will be taken to an alternative boot screen with a “Mac OS X Utilities” menu.
In order to complete a system restore, you will need to connect your computer to the Internet. Select “Wi-Fi” from the Utilities menu and find the router you will be using. Enter your Wi-Fi username and password to connect.
Depending on which version of OS X you are using, your Utilities menu will be slightly different. Look for either “Internet Recovery” or “OS X Recovery,” and select whichever one you find. This should present you with a “Reinstall OS X” option. Click on it, and then wait as your MacBook Pro connects to the Internet and gathers information on your laptop from Apple servers.
You may be prompted to provide your Apple account information, including username and password. If so, provide it. In any case, this process will eventually reach the point where your MacBook downloads the latest version of OS X, as well as the standard programs that Apple includes pre-installed on every laptop. Your hard drive will then be automatically formatted, and the computer will restore itself to factory settings.
Once the reinstallation process is completed, you can either restart your computer, provide your Apple ID information, and start copying your files back over to the computer from your external hard drive, or you can turn the computer off and go about selling it to a new owner.