Addressing CDs and DVDs automatically ejecting in OS X
Every now and then optical drives in Macs may automatically eject discs. There are several reasons why this might happen; here are some possible remedies.
Apple included an optical drive in most Mac models, and even for those who do not have an internal drive there are options for using external USB or Firewire drives. While optical drives should accept formatted and blank optical media, there are times when people find that discs automatically eject from the drive when inserted.
This happens because the drive cannot recognize the formatting of the disc and also does not recognize it as a burnable medium. Usually the drive will recognize a disc and attempt to communicate its file-system structure to the computer, but if it cannot read the disk because of scratches or dirt, then it will spit the disc back out again. To see this, on a working drive just insert a disc label-side down, and the drive will eject it.
If your drive is ejecting discs, it can mean one of four possibilities:
Drive lens is dirty
Over time a drive's lens may collect dust and debris, which can prevent the lens from reading properly. If this happens then most discs inserted into the drive will be ejected, including commercial discs. To remedy this, you can try blowing compressed air into the drive in an attempt to dislodge any debris on the lens.
Disc is dirty or damaged
Like the lens, if the disc is dirty or has scratches on it that impede the tracks of data then the drive will also not be able to read it, and will eject it. Old discs (especially home-burned ones) may also experience degradation of the media over time that can result in the disc no longer reading properly. Beside gently cleaning the surface of the disc, you can use various resurfacing and disc reconditioning products to attempt to fix scratches and gouges in the disc's surface.
Disc media is incompatible
Manufacturers mass-produce optical media in batches, and every now and then a batch may be incompatible with a given drive for whatever reason. In this case a whole stack of burnable discs may not work, but others from a different brand will. This happens most often with burnable media, but may happen for commercial discs as well. If this happens then your best bet is to try another batch of discs with your drive.
Drive is broken
The final option is if the drive itself is broken. Over time the drive's lens may become misaligned or the firmware may go bad. As a mechanical device with feedback controls, the mechanics and sensors may also stop working as well as they did, resulting in the firmware getting hung up and refusing to work properly. If your drive is broken, then the easiest solution is to have it replaced.