First please shut down the iMac, then disconnect all cables including the power cable.
Leave everything disconnected for at least 60 seconds, then just reconnect the power cable and mouse and keyboard.
Next reset the PRAM. The PRAM stores things like display brightness, and some sound settings.
To reset PRAM, press the power button and immediately press and hold these four keys:
Command + Alt (option) + P + R
You must press and hold down all four keys immediately after you press the power button on the iMac.
Keep holding those keys until you hear the second startup chime, don't release them until you hear the startup chime for the second time.
If this does not resolve your issue, or if your iMac starts up without making the startup chime, please get back to me and tell me exactly what has happened.
If I have resolved the problem please take a moment to click the star rating to rate my help, many thanks!