Re: How to reset iphone 5 to factory settings
1. Disable the Find My iPhone option.
2. Create a backup either via iTunes or iCloud.
3. Sign out of EVERYTHING you're signed into on the device....iCloud, iTunes & App Store, iMessage, Facebook, Twitter, FaceTime, etcetera.
4. If you have music & videos that you did not purchase from the iTunes Store stored on the device, upload it to your computer or an external drive.
5. Make sure all of your precious pics are saved off of the device,.
6. Go to Settings → General → Reset, and then select "Reset All Contents and Settings".