Pair bluetooth keyboard when not logged in
Here is a solution as noted here: How to unpair keyboard without original computer

Their solution was to:


Disconnected everything USB, etc. from the computer.
Restart the iMac while putting the new/different keyboard into discovery mode, and wait for the iMac to detect it.



  The deal is you have to unplug ALL USB devices, have your wireless keyboard and mouse turned on, and restart. The system sees that there are no input devices and searches for them. Then asks you to type a passcode and hit return.