Choose Computer from the Go menu
 
Double click on Macintosh HD
 
Double click on Library
 
Double click on Preferences
 
Delete the file com.apple.Bluetooth.plist
 
Hold down the Option key and choose Empty Trash from the Finder menu
 
Choose Shut Down... from the Apple menu
 
Unplug all USB devices from your Mac.
 
Wait 2 minutes, then startup you Mac.
 
When startup is complete, pair the keyboard to your Mac, according to the setup procedure outlined in the manual.
 
Try typing something, to confirm that the keyboard is working properly.

If it is, then pair any other Bluetooth devices you may have, and confirm that they work properly.
 
Finally, you may now plug in your USB devices.