Hi maffemaffe:
I had a similar problem on my iMac. In my case, I was getting "unspecified error" over and over. In some cases, I just got kicked back to the iCloud login dialog window like you are after watching the "spinner" icon spinning around (not the beachball...the"throbber" as they're sometimes called).
I tried all the solutions I could find here and on other articles about errors signing in to iCloud. None of them worked for me. I tried all of the fixes people are giving you here as well as many other suggestions from other sites...none worked.
What DID work for me was:
1. Explicitly Sign Out of iCloud, iTunes store, and App Store.
2. Login through iCloud.com in the Safari internet browser and see if the Mac you're having problems on is still shown as logged in under the settings page. If it is, remove it manually. I don't think this is a super important step, but I did it anyway.
3. Logout of icloud.com and create a NEW, temporary iCloud account using a totally different email address from your original account. As you know, creating an iCloud account is, itself, is a multi-step process. Sigh.
4. Then go into System Preferences -> iCloud and Sign In with the new temporary iCloud account credentials.
5. When your Mac is finished signing into that temporary iCloud account, sign right back out.
6. Try again with your original iCloud account credentials (presuming your password is correct).
- Bill