Are you getting the message sign out is not available due to restrictions on your iPhone or iPad?
If you are trying to sign out a child’s account on iOS 12, you may see this issue. You most likely have Screen Time enabled on the account. To sign out of the iCloud account you will need to have the parent account device make the change first.
On the parent’s iPhone or iPad go into Settings and click on your Apple ID picture at the top. Next you will want to click on Family Sharing. At the bottom you will see Screen Time. Click on the child that is getting the sign out is not available error. Click Turn Off Screen Time. (You can re-enable it after you sign your child out).
Now back on your child’s device, make sure to force close settings. Double clicking the home button and swiping up, or on newer devices without a home button, pull up from the bottom slowly to bring up the app switcher, then swipe up to close out settings.
Now open settings back up and you should see the option in iCloud to sign out.