If you're using iOS version 10.3 or later:
1. Go to 'Settings'
2. Tap on your name
3. Scroll down and tap 'Sign Out'
4. Enter your Apple ID password when prompted
5. Tap 'Turn Off'
If you're using iOS version 10.2 or earlier:
1. Go to Settings > iCloud > Sign Out
2. Tap 'Sign Out' again
3. Then tap 'Delete from [My device]'
4. Enter your Apple ID password when prompted
5. Next go to Settings > iTunes & App Store > Apple ID > Sign Out