This is how your reset your device to wipe the data:
How to factory reset your iPhone, iPad, or iPod touch - Apple Support
Signing out of your account does not remove clear your device. If you restore from a backup, all the data will be restored just like the device was when it was backed up last. To start fresh with a different Account, you would not restore from a backup and enter your new account when setting the device up after the reset. You will have no photos, contacts or third party apps that were downloaded previously with another Apple Account on your device.