Reinstalling MacOS X Snow Leopard on a Mac over a crashed linux Ubuntu
You may need to separate the boot process from the CD reading.

First, power off and reset the NVRAM by holding option + command + P + R

Then, I would boot with the option key held until you have a grey screen. Once the Mac is at the boot chooser (no apple logo yet), you can then insert the CD.

This is firmware running the Mac, so you don't even need an internal HD to mount the CD. If it ejects, you need a repair of the drive or a replacement CD.

If the Mac can't boot to the boot chooser, then you have a hardware issue on the Mac.



Looking over the further details, if your Mac can't boot to the grey screen then there is a hardware issue. It might be as simple as disconnecting a failing HDD or just reseating the HD cable. It also might just need you disconnecting every single peripheral and bringing a new keyboard to the hardware.

I'd seek assistance from AppleCare or a hardware tech if you can't get the boot picker to show up. You could also see if your Mac supports internet recovery, but some 24 inch iMacs were made before that was added to the firmware.