Reset to Factory Settings -
Settings > General > Reset > Erase all contents & settings
Sign out of any email accounts - in particular, any Gmail accounts.
Then, go to - Settings > Backup & Reset > Factory Data Reset
If you can't access your settings, you will need to reset your device in Recovery Mode - click here for instructions.