Restoring your macbook to its factory settings is fairly straight forward. Restart your mac and hold "Command" + "R" while rebooting. You will enter the OS X Utilities section.
1. Erase your main drive. Under the disk utility option select your main startup volume and click unmount.
2. Once you do click the erase tab to erase your hard drive.
3. Once finished exit this program to head back to the OSX Recovery settings.
4. When back in the main menu select "Reinstall OS X" to continue with a full OS reinstall. This process downloads and installs an OS to your system.