Make and model of the laptop may help us here.
If your eject button on the optical drive itself does not work, you can try to either; use the eject option within windows or, the ultimate emergency method which is to push a straightened paperclip into the small hole on the optical drive which will manually unlock and open the tray