Open Settings
Tap your name at the top
Scroll down and tap Sign Out
Enter the Apple ID password
Tap Turn Off
Choose whether to keep a copy of your data on the iPhone
Tap Sign Out again to confirm
Enter the iPhone passcode if prompted
If Find My iPhone is enabled, turn it off when asked
If you do not know the Apple ID password, use Apple ID account recovery
If the iPhone is not yours, ask the owner to remove it from their Apple ID in Find My or iCloud settings
