Brand new iMac, cannot login to anything
I've had this a number of times after installing a new copy of OSX, sometimes I was able to link to iCloud etc subsequent to install but ALWAYS with other problems that came up later, it never cleaned everything up to be working 100%. I also spent a lot of time and effort with second level AppleCare to no avail.

The ONLY successful solution I found, unfortunately, was to clean install over and over until it went through successfully. This often had to wait a number of days.

Personally, I suspect network issues which Apple were unable to pin down.

Eventually, all the computers I had issues with (which included a brand new iMac) worked and have worked ever since - about 2 years (Plus one 6 months ago).

Good Luck!

Paul.