How to erase your iOS device and then set it up as a new device or restore it from backups
Erase your device
Erasing all content and settings will delete all of the data from your device, including songs, videos, contacts, photos, calendar information, and anything else. All device settings are restored to their factory condition.
To remove all settings and information from your device, tap Settings > General > Reset > Erase All Content and Settings. Learn more about "Erase All Content and Settings."
If you can't erase your device, restore the device using iTunes.