You'll need an Android phone/tablet factory reset before you sell your device or set it as a new device. You can even perform a factory reset when your phone can't boot normally. Read this post to learn what factory reset is, when to do a factory reset and how to factory reset Android phone.
A factory reset is the ultimate cleansing of your Android device. When you perform a factory reset you're essentially wiping out everything you've ever done to the phone or tablet and restoring it back to the basic manufacturer software. It doesn't uninstall any software updates you've received from the phone manufacture, but it does wipe out any core application updates you've downloaded after buying the phone. Or put it another way, factory reset your phone to the state when you bought it.
So you might lose some important data after factory reset your Android phone or tablet. In this case Android Data Recovery could help you do the data recovery. Just free download it and have a try.
If you install a lot of apps and some of them are acting a little mischievous, or maybe something has just gone wrong deep down in the system where you have little chance of fixing it. Wiping the phone clean and starting over is the best overall option sometimes. What's more, if you are about to sell your phone, you must want all your personal data gone before handling the phone to its new owner. And factory reset could just clean up your data in these cases.
As factory reset wipes most of your data, it's highly recommended that you do some precautions before doing the factory reset.
Once you select to factory wipe your device, all info will be wiped including contacts (unless they're synced to your Google account), pictures, documents, and everything else. It returns the device to as it was when you just bought it.
Once hit, the device boots into recovery and wipes it clean. After it is done, it will reboot and your device will act as if it is brand new with all of its content gone.