For iPhones without iCloud account
Step 1: Connect your iPhone device to the computer with a cable and turn on iTunes on the computer.
Step 2: Turn off the iPhone by pressing and holding the power key until the slider appears, then right-click to turn off the device.
Step 3: Put the iPhone in DFU mode by pressing and holding the Power and Home keys simultaneously for about 10 seconds.
Step 4: After holding for 10 seconds like step 3, remove your hand from the Power button but continue holding the Home key for about 10 more seconds.
Step 5: Next, on your computer, click "Restore" on iTunes. At this point, iTunes will notify you that the device is in need of recovery, click "OK" to confirm it is complete.
When your device has an iCloud account
In case you do not remember the iCloud account password on the phone, this case will not be able to continue.
In case you remember your iCloud account password, follow the instructions as above. Until the required step, login account and iCloud password, then you login to reactivate the iPhone.
Enter the iCloud password