Turn your Mac on, and let it sit for a couple of minutes. If you shine a bright light into the screen, can you see any part of your video, such as icons, or the menubar at the top of the screen? If so, your backlight may have failed. If you think that the computer seems to be working, but stays completely black, then the inverter board may need to be replaced. Either way, your iMac will need service.
Be sure to try the screen brightness keys on your keyboard, and also try restarting while holding Option-Command-P and R. You'll hear the boot chime sound. Keep holding those same 4 keys until you hear the boot chime two more times, then release those keys. IMMEDIATELY hold down Option-Command-O and F (that's the letter O, not the number 0). If the screen lights up to show you a text screen, you may be OK now. Even if if the screen continues to remain black, type the following: (there's no spaces, just a dash between the words)
reset-nvram
then press the return key.
If you can see the screen, you'll see OK
Then type reset-all, and press return again.
Your iMac should restart, so you should hear the boot chime as it restarts. Assuming all you needed was a reset, you should have your screen back.
If not, then you have a hardware failure inside.
The older G5 iMacs are prone to both power supply, and video failures because of faulty capacitors. Yours may have the same failure, simply because of age.