To eject a CD or DVD disc, you normally press the ⏏ key on the keyboard or the ⏏ symbol to the right of the CD or DVD name in the left pane of the Finder
Once in a while, however, a disc becomes stubborn and doesn't want to eject. Here are a couple of things that you can try to get that disc to eject:
Use Disk Utility.app. It is located in the Utilities folder of your Applications folder. Disk Utility lists all of the mounted drives and discs in the left pane. Select the disc in the left pane and then click the ⏏ eject button on the toolbar.
Reboot your Mac holding down the mouse button until either the disk is ejected or you get to either the login screen or your your account (depending on whether or not you have your Mac set up to go to the login screen or to just log in automatically to your account.)
If the disc still won't eject then it might be time to try some more drastic methods. Over the years I have read some pretty wild ways to try to eject a stuck disc. You can find lots things to try by Googling "Mac stuck DVD". Be warned however that most of the "drastic" methods will surely void the warranty on your Mac.
A much safer (but potentially expensive) way to get the disc out is to locate a Mac repair specialist. A Genius at the Genius Bar at the Apple Store might be able to help, but a stuck disc might require disassembling your Mac to get it out.
WARNING: Never ever ever insert one of the small (about 3") discs into a Mac media drive. They don't read and they don't eject no matter what you try. Inserting one of these small discs guarantees you a trip to Apple Repair-land.
Shopping online? You can help support Basics4Mac by making your Amazon purchases through this website. Simply click the link below and you will be sent to Amazon.com. Any purchases you make at Amazon by going through this site will give me a small commission. It does not affect the price of the items you buy.