iCloud connection after upgrade to High Sierra
I had the same issue and fixed it as follows: 

In your user folder, go to ~/Library/Keychains/ (hold down the "option" key when clicking in the "Go to" menu to show the Library folder). 

In that folder, there are the regular keychains, plus some folders with monstrously long names like F2555809-AAC0-5CFA-BEF6-57BB56345BIUR or some such. 

I deleted those folders only. 

After a restart, my email accounts and everything else had been logged out and the system requested a log-in password to my Apple ID. I was able to re-enter it, and since then, all iCloud services have worked fine, including Photos, iCloud Drive, iMessage, etc. - even text replacement is now syncing fine.