How can I tell if my computer is on? I've got a late 2015 iMac with a Bluetooth keyboard and mouse.  As part of the minimalist design, Apple appears to have eliminated all the indicator lights.  If the screen is black and the computer doesn't respond to either the keyboard or the mouse, how can I tell (a) a computer that's been turned off from (b) a computer where the batteries on the keyboard and mouse have run down?

If the computer is off, I don't want to turn it on, so pressing the power switch is out.

(This question came up in the context of unplugging the computer from a malfunctioning UPS, where I couldn't tell if the UPS had shut the computer off or not.  If the computer was off, I didn't want to turn it on and risk having the UPS shut it off again halfway through the startup routine; if it was on, I wanted to shut it down properly before unplugging it.)
As you have the iMac on a UPS, you could use the power consumption readout that is usually available on a UPS. I.e. if the power draw is above a few watts, the computer is on - if it's not, the computer is off.

Another option is simply to connect a cabled, USB mouse/keyboard instead of the Bluetooth. As having a malfunctioning UPS at the exact same time your mouse runs out of battery, whilst also being the exact same time your keyboard runs out of battery, is quite rare. Therefore it shouldn't be a problem to spend a little extra time plugging it in USB.

A third option is using a cabled network or WiFi connection to check if the Mac is powered on. You could do that by for example pinging the Mac from another computer, smartphone or tablet. If it responds to pings, it is powered up - otherwise it is powered down. Obviously the computer needs to be connected to the same network in advance for this to work.

A fourth option is to use another computer or specialized hardware to check for Bluetooth/WiFi signals being emitted from the computer. This only happens when the Mac is powered.

A fifth option is to use temperature-sensing equipment (depending on your scenario, it could be your hands) - to sense/feel if the iMac is warmer than room temperature or not. If it is warm, it is powered (or was recently powered).

And finally, if your Bluetooth keyboard is actually an Apple keyboard, then you can press the caps-lock key to detect if the keyboard battery is dead. If the keyboard is not dead, then you can use it to check if the iMac is powered on. If the keyboard battery is dead, you can recharge it.