What to do before selling or giving away your iPhone, iPad, or iPod touch [or if you received one that had not been erased] - "Use these steps to remove your personal information from a device, even if you don't have it anymore." --> https://support.apple.com/HT201351
Do the above, but it is quite possible you are encountering activation lock, in which case:
Turn off Activation Lock --> https://support.apple.com/HT201441 - An activation lock can only be removed using the log-in information for the account that applied the lock.
If this is a device for which you are not the original owner, get the owner of the account to remove the lock or return the device for a refund. The device is otherwise useless to you. If the owner has not provided contact information as a message showing in the login screen there is no way to contact the owner unless the person who gave you the device knows them.