I logged out of iCloud on my iPhone and now it won't let me log back in
This answer offers an alternative to the one posted by user @Sacha on May 10th of 2018. For Apple users (like me) that cannot remove 2-factor authentication (because their account does not feature the link to do so), try this:

Log into your Apple account from a computer (appleid.apple.com or icloud.com). That step will require you to use your 2-factor authentication, as expected, so have your phone handy.
Scroll to the &quot;devices&quot; section. Verify that all shown devices are correct and not listed more than once. In my case, my iPhone was listed twice and that seemed to confuse the iCloud login algorithm. If that's the case, remove all duplicate(s) from the &quot;devices&quot; list so you only have a single phone listed there, and log out.
From your phone, try logging in again to iCloud.
If that still does not work, log into your Apple account from your computer again, and remove the device causing problem from the list completely. Log out. Now you have a clean slate.
Grab your phone, and try logging in again to iCloud. This time, you may need to force the 2-factor code to be sent by SMS, instead of iMessages (since you might no longer have access to the iMessage app).
Hopefully, this time around, your iPhone will complete the login process into iCloud and you will see your device on the Apple account page next time you access it.