Does your iMac startup normally without putting in any disc? If not, I assume that's the reason you're trying to reinstall the OS, right?
If your iMac doesn't startup normally on it's own, that would be an indication of a hard disk problem, or failure. If you put in the install disc and restart while holding down the 'C' key until you see the spinning gear, that should force it to boot from the CD. But if it's spitting it out when you do that, it could indicate a failed CD/DVD drive?
Does your iMac read any music or data CD or DVD, or does it not mount any of them on the Desktop?