First, ensure that it’s plugged in fully. I know it’s common sense but for an iMac the one plug that runs everything can easily be hit with your foot under your desk. Overtime it can work it’s way out until it’s barely unplugged but just enough.
Next, if you have a surge make sure it works. If you don’t make sure you get a good one with a warranty that will cover the computer plus all necessary data recovery that you may have. It can be VERY EXPENSIVE to send your hard drive off to get your data recovered. (Always keep two external HDs plugged in for backup)
Third, depending on how you found it are the next steps. If it just shut down, it’s possible it’s crazy hot and not getting air. Generally there will be an error message to the affect of “Heat”. I don’t remember the correct error. If that’s the case let it cool down completely then ensure it is getting plenty of air flow. Use a small desk fan to have it blow behind and under it will help. If it’s a laptop NEVER place it on a pillow. You’re asking to kill it. It needs to breath just like we do.
Last, hold down the power button for 5 seconds and listen. It’s possible you will hear it boot up. If so make sure the monitor is plugged in properly. They sometimes loosen over time just like your power supply will. If it doesn’t at least kick on at that point time to call a certified mac representative and see what they say.