Taking up Bob's point on post #3; if your iMac has a chime (ie normally makes a chime sound on boot up), Bluetooth (BT) isn't recognised or activated until immediately after the first chime. Consequently, if your Keyboard is of the BT type (eg Apple Magic Keyboard), you need to reboot the iMac, wait for the chime, then immediately hold down the Shift key and keep holding it until the Apple logo appears.
Then it will take you into Safe Mode.
The same principle applies to using Command plus R to get into Recovery Mode.
There is a way round this, however. If you have the Apple Magic Keyboard, connect it via USB to the iMac (as you would to recharge the battery). This effectively converts it to a "wired" KB and you can hold down the Shift key (or Cmd plus R) from the start of the reboot.
See if that helps.
But above all, we really do need to know as much as possible about the Model, Year, Specs and Operating System (OS) as you are able to provide under your difficult circumstances.
Ian