There are many possibilities, such as a bad contact to an accumulation of dust in the mechanism.
There should be a manual ejection hole, probably just under the tray. To small for a head phone plug.
An unbent paper clip is normally used for that task.
Insert the paper clip into the small hole and push in. The tray will start to open. You can now gently pull it open.
You are better to make it close and open a few times with the eject/retract button to make sure that it work correctly. Don't put in any CD at this time.
If it was only dust, then every thing should now work correctly.