For some reason, I tend to come across times when my optical drive doesn't want to eject the CD or DVD that's in it. I found myself having to restart the computer and try again... in more serious instances, I have to restart and force-eject the disc by holding down the mouse button during the boot process.
At some point I thought to myself, "There's gotta be a better way to do this." Having to restart my computer when a disc doesn't want to eject is not exactly user-friendly. After pondering the possibilities for quite some time, I remembered that you could enable some menu extras (including an eject button) from the CoreServices folder.
Go to the root of your hard drive, either by choosing "Computer" from the Go menu or by clicking it in the sidebar of a Finder window (my hard drive is the icon labeled 'Server' in the screenshot), and follow this path:
System > Library > CoreServices > Menu Extras
Once in that folder, you'll see a lot of different extras that you can put into your menu bar. Just double-click the ones that look appealing to you and they will appear in your menu bar. Go ahead and give them a try. If you decide that you don't want something in the menu bar, just hold down the command key and drag it off the bar.
The eject button doesn't always fix a stuck CD, but it's one more option to try before restarting my computer.