Open Settings
Tap your name at the top
Scroll down and tap Sign Out
Enter your Apple ID password if prompted
Tap Turn Off for Find My iPhone if asked
Choose whether to keep a copy of your data on the device
Tap Sign Out again to confirm
Wait for iCloud to log out completely
