Apple - Suddenly Apple Wired Keyboard not working
This is what solved it for me:
Eventually I found this thread on the Apple website, and followed the rather bizarre advice of adding a USB extension cable between the keyboard and the Mac (luckily the keyboard comes packaged with one). Bingo! Keyboard fine, mouse plugged into it also fine.
http://www.zigpress.com/2014/12/30/has-your-apple-mac-external-usb-keyboard-stopped-working/
I think the problem is that the keyboard draws so little current that it won´t wake the port if you have the Apple keyboard with a usb hub.
Just stick a usb memorystick in the keyboard and re-insert the cable. If it works then just remove the memorystick or what ever you put in (doesn´t matter what).
I resolved my issue by following the SMC Reset instructions here.
Basically unplug everything, power down the mac, hold the power button for 5 seconds. Once the system has rebooted then reattached all peripherals. Then my keyboard started working again.
Kieran