From the iPhone 5 home screen, select Settings.
Once inside the settings application tap General.
Scroll to the bottom and tap Reset.
Follow the on-screen instructions and select Erase All Content and Settings.
Finally, confirm that this is what you actually want to do by tapping Yes.
Your iPhone 5 will now erase everything and reboot.