I use an Apple Bluetooth keyboard on my iMac. It works great most of the time. Occasionally, I experience keyboard lag which can be infuriating. I usually end up restarting either the iMac or keyboard which seems to fix it. If you are experiencing this problem, then read this article listing several troubleshooting steps that can fix it.