Starting in iOS 10.3, Apple changed the location of the iCloud settings. The basic iCloud settings can now be found under Settings -> [Your Name] -> iCloud. Unfortunately, you can not sign out of iCloud from this location. To sign out of iCloud, go to Settings -> Accounts & Passwords -> iCloud. Scroll to the bottom and you will see the option to Sign Out.
In iOS 10.2 and below, the sign out option was grouped with all the iCloud settings under Settings -> iCloud. Simply scroll to the bottom of the screen and select Sign Out.
Tapping Sign Out will delete the iCloud account from your iPhone. It will not delete the account on any other devices you may have. Your iCloud data should still be available on other Apple devices and the iCloud website https://www.icloud.com.
Once you select Sign Out, the iPhone will ask if you want to delete or keep the data on the iPhone. If you delete the data from the iPhone, all contacts and other iCloud data will be deleted from the iPhone. If you keep the iCloud data on the iPhone and sign in with a different Apple ID, the iCloud data (such as contacts and calendar data) can be merged to the iCloud account for the new Apple ID.
This article provides additional information about iCloud.