I have a 2010 iMac. I don't use it every day. Once in a while, it seems to boot, but the screen is black.
It showed that about 2 weeks ago.
I opened up the iMac, so I could tilt the display screen forward. That allowed me to see the row of LEDs on the front of the logic board. There are 4 LEDs that will light up in sequence during boot. Of course, THAT boot with the LEDs visible worked for me (that time), with the screen lighting up.
That's a 21-inch iMac.
On a 27-inch, the test LEDs are visible by looking through the vents near the center of the bottom edge, without opening the iMac. You can carefully tip the iMac back to view those LEDs.
#1 LED will be ON anytime the power cord is attached.
#2 should come ON after pressing the power button.
#3 the Mac is communicating with the graphics chip. If #1 and #2 are on, but LED #3 stays off, then the graphics card may have failed.
#4 LED - if the display screen is on, all should be good. If #4 LED is on, but the screen is not lit, then you may have a failed LCD panel (the display), or a problem with the LED backlight board, or even a failure of the video cables.