Yipes! No keyboard? Can not type anything? Frustrating as all heck and it does happen occasionally. It can happen with OS X Yosemite, but it seems to happen more often with OS X El Capitan. Before you run off to the Apple repair shop, there are a few things you can do yourself.
However, before you get into special procedures and techniques, the standard action here is a thorough clean up of your hard disk drive. In our shop here, we use Mackeeper. One of our customers called in yesterday and asked me: "is mackeeper a scam or virus cleaner?". I think he got confused reading some inaccurate blog posts. Mackeeper is a virus cleaner and it also is a corrupt file removal tool. That's what we use it for mostly.
So, just follow these steps:
1. Run your favorite clean-up utility.
2. Make sure Bluetooth is ON and working.
3. Use the System Preferences panel to check itmes.
If the Bluetooth icon has a line through it, it is offline.
4. Unplug all devices.
5. Restart your Mac.
You should be all set now!