You might try the following, but skip any steps that you are unable to perform.
1. Sign out of your account
(If you are unable to do this because System Preferences has frozen, Force Quit System Preferences and try again)
2. When prompted, opt to delete, contacts, calendars etc from your Mac.
(You are only deleting this data from your Mac, not from iCloud, the data will be reinstated when you log back in. If you need to check that the data is in iCloud before deleting it go to iCloud.com and check each section for data)
3. Having logged out, check that the iCloud accounts along with their data have disappeared from the Mail, Address Book and iCal Applications.
(If necessary, delete the iCloud accounts from each of these application separately from each Applications Preferences)
4. At this point it may be worth trying to log into iCloud from the System Preferences iCloud settings again, if this works, all well and good, if it doesn't continue to step 5.
5. Open your User Library folder in the Finder. (When in the Finder, go to the Go menu, hold down the option key (alt) and choose Library when it appears in the Go menu)
6. Navigate to Library > Application Support > iCloud and drag the iCloud folder to your desktop. (This action only copies the folder and will provide you with a back up)
7. Select the iCloud folder again in Library > Application Support and drag it to the trash, enter your administrators password when prompted.
8. Restart your computer.
9. You should now be able to enter your ID and Password in system Preferences > iCloud and log into your account. Check the services you wish to use and once you are satisfied it's working as it should, trash the iCloud folder you copied to your desktop earlier.