Learn how to sign out of iCloud from the Settings menu on your iPad or iPhone.
Steps
Method 1 of 2: Use iOS 10.3 or later

Step 1. Go to your iPhone settings
This application is represented by a gray cogwheel which is located on the home screen of your iPhone.

Step 2. Tap your Apple ID at the top of the page
Your name and photo will appear at the top of the menu Settings. Tap on it to access your login menu.

Step 3. Scroll down and select Sign Out
You'll see this listing in red at the bottom of your Apple ID menu.

Step 4. Type your password
You must deactivate the service Find my iPhone before you can log out. If this option is enabled, you will be prompted to enter your password in a dialog window to disable it.

Step 5. Press Disable in the dialog window
This action will disable the service Find my iPhone on your device.

Step 6. Select the data to keep on the device
However, you may have a copy of your contacts and your browser settings after logging out. Slide the button to the right to select the data you want to keep. Once done, the button will turn green.
If you decide to delete this data from your device, be aware that it is still available on iCloud. You have the option to reconnect and sync your device at any time

Step 7. Tap Sign Out
It's the blue button in the upper right corner of the screen. When you press it, a window will appear asking you to confirm your action.

Step 8. Select Logout to confirm
This action will remove your Apple ID from the device.
Method 2 of 2: Use iOS 10.2.1 or earlier

Step 1. Go to your iPhone settings
This application is represented by a gray cogwheel which is located on the home screen of your iPhone.

Step 2. Scroll down and select iCloud
This option is represented by a blue cloud icon that is in the middle of the menu Settings.

Step 3. Tap Sign Out
This option is at the bottom of the iCloud menu and is written in red. When you press it, a confirmation window will appear at the bottom of the screen.

Step 4. Select Logout from the window to confirm
This option is written in red and when you click on it, another window will appear.

Step 5. Tap Remove from my iPhone / iPad
The option is listed in red. Signing out of iCloud will delete all of your notes from the device. By pressing this option, you will confirm your action. After which, another window will appear.
The Notes service will still be available on iCloud. You can reconnect and sync it at any time

Step 6. Select Safari if you want to keep its data
Your browser history, bookmarks, and tabs are synced when you sign in on devices with your Apple ID. You have the option of keeping your browser data on your device or deleting it.

Step 7. Enter your password and Apple ID
You should deactivate the service Find my iPhone before you can sign out of iCloud. If this feature is enabled, you will be prompted to enter your password to disable it.

Step 8. Tap Sign Out
This action will turn off the phone's location service and log you out.