This is a very brief post, offered in the hope that it may help someone save the time that I wasted trying to get my Apple USB keyboard to work after it stopped responding.
Basically, the keyboard sometimes worked when plugged in to my MacBook Pro Retina, but sometimes just totally failed to respond, and the mouse plugged into its extra USB port didn’t work either when this happened. If I plugged the same mouse directly into the Mac, it worked fine.
Resetting the Mac’s SMC and PRAM had absolutely no effect. Either the keyboard would work, or it wouldn’t, seemingly at random.
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.
So, if your Mac USB keyboard suddenly stops working and you can’t figure out why, try adding a USB extension cord or plugging it into a powered hub instead of directly into the Mac.
I have no idea why this works but it does!