Lately I’ve found my 2013 Logitech K760 solar keyboard suddenly disconnecting from the iMac for no obvious reason. One thing lacking in this keyboard is any battery level indicator. The keyboard has some nice features in addition to the solar-charged internal battery: three separate Bluetooth channels for instant connection to three distinct devices; Home button for use with iPad/iPhone and the ability to go for three months on a single battery charge.
This tendency to suddenly disconnect from the iMac started soon after I bought the M1 MacBook Air. Quite simply, the iMac often went for a week without use, with the computer & keyboard in a darkened room.
The poor keyboard just wasn’t given the chance to get recharged.