This discussion pertains to activation lock; all iDevice possibilities are covered below. So, if your activation lock problem is solvable, then this discussion will give you your solution.Note that no one here is authorized to provide instructions for removing activation lock and that activation lock is a theft deterrent system.
See Turn off Activation Lock https://support.apple.com/en-us/HT201441See this heading If you erased your own device. It says: "If you don't sign out of iCloud before you put your device in recovery mode and restore, it might remain in Activation Lock.” That means you need to enter the same Apple ID and password that was used when the device was last set up.
Use forgot your Apple ID or your Apple ID password to recover the needed credentials if you don't know them.
If you have iOS 11 or later and your account is protected with two-factor authentication, you can turn off Activation Lock with your device Passcode. Tap Unlock with Passcode, then tap Use Device Passcode."
_________
Note that no one but the person that last set up the device will be successful in following the above instructions. So, if you are not that person, you will need to get the required password from the person that last set it up.
If you are the last person that set it up and can't follow the instructions successfully, then you will need to contact Apple Support and present your original purchase receipt for a pertinent device from an authorized Apple seller with the device’s serial number on it.
If you have the receipt, then you can use the support options below in trying to solve your problem. Alternatively, if an Apple Store is open in your area, then you can go there to deal with your problem. In this case, you can make a genius-bar appointment (https://www.apple.com/retail/geniusbar/) if you want.
Get a call from Apple support to help solve your problem using this
link https://getsupport.apple.com/?caller=kbase&PGF=PGF63005&category_id=SC0245&symptom_id=23362
Apple ID Support https://support.apple.com/apple-id
Apple ID account security for country-specific and
region-specific help https://support.apple.com/en-us/HT204169
Get Support: We’re here to help https://getsupport.apple.com/. Go through the options to find the best support option.