Remove any paired devices, such as an iWatch.
Go to Settings and sign out of iCloud.
Go back to Settings and tap General > Reset > Erase All Content and Settings.
If asked for your device passcode or Restrictions passcode, enter it. Then tap Erase.
If FRP (Factory Reset Protection) is on, go to Settings > Lock screen > Screen lock type and choose None.
If you have a Google account, go to Settings > Accounts and backup > Accounts and tap on Google, then tap Remove account.
From Settings > Factory Data Reset > Tap Reset > Delete all.
If asked for your device passcode enter it. Then tap Delete all.
From Settings > either Backup and Reset or Privacy > Tap Factory Data Reset > Erase everything.