It happens to everyone sooner or later. I'm referring to a CD or DVD that gets stuck in the Mac's optical drive. This happens when you insert a CD or DVD, but the drive fails to read the media or doesn't recognize that any media has been inserted. Since the CD or DVD never mounts on the Desktop, you can't drag its icon to the trash to eject it, because there's no icon to click on.
Likewise, if you have installed the Eject menu item, chances are it won't force eject the media because the system is reporting that there's nothing in the drive.
If you reboot your Mac while holding down the mouse button, this will force eject the media. But if you're in the middle of doing something else, it may not be a convenient time to reboot. You can use Terminal to get the job done instead. For details, take a look at: