Question: apple keyboard has stopped working?
Answer: Hold down the Shift and Option keys ('Alt' on some keyboards) and at the same time click on the Bluetooth icon in the menu bar. Once the menu is showing, release the keys. From the Bluetooth menu, choose Debug > Remove All Devices. Reboot your Mac, then setup your keyboard and/or mouse as normal.