When the drive gets stuck, you have to try to save the drive, save the disc, and save your reputation as a level-headed person who doesn’t go hoarse screaming at non-sentient machines.
Maybe the problem is with the button. Try telling Windows to eject the tray. In Windows 7’s Windows Explorer, go to Computer. In Windows 8 or 10, go to File Explorer’s This PC. Right-click the optical drive and select Eject.
If that doesn’t work, there may be a program holding onto what’s on the disc. Try closing a few obvious culprits. If that doesn’t do it, try closing everything.
Or, better yet, reboot the computer. Press the drive’s eject button as soon as the shut down is complete and the new boot is just starting, before the PC tries to load an operating system.
If that doesn’t work, we can safely assume that the problem isn’t with Windows. But we still have a problem.
Shut down the PC again, and this time, don’t reboot. Bend open a paperclip. If you look closely, you’ll almost certainly see a small hole in the drive’s front panel. If there are two holes, and one looks like it’s intended for plugging in headphones, it’s the other hole.
With the PC off, insert the paperclip into the hole and apply gentle pressure. The drive should pop slightly open.
Gently pull the drive out. If it doesn’t open gently, the disc is probably dislodged. Carefully try to maneuver the disc so that it’s sitting where it should. If that won’t work, try to find a way to remove the disc without ruining either the disc or the drive.
If you continually have to use the paperclip trick, you’ve got a bad drive.