Recently experienced the above when booting up the iMac. Batteries on both keyboard and magic mouse were ok and I can see the tiny green lights on both were blinking apparently attempting to connect to the iMac. This goes on and no conenction was eventually made. Have experienced this with the MM before but not the KB.

I then attached a wired mouse to the USB port and restart the iMac and connection to the KB and MM was then established.

Is this a sympton that the bluetooth of the iMac is failing or this is a common experience among iMac users?