Eject The Tray
Try and eject the tray using the physical eject button located on the lower right of the desktop computer optical drive. If this fails to eject the tray, it would be an indication to you that the optical drive is not getting any power. You will then need to power down the computer using the OS or the power button and then open the case and reconnect the power cable. If the tray opened during testing, then the data cable is the one that needs to be reconnected. Often, optical drives rest over hard disk drives so if the hard drive was upgraded or replaced recently, the cables may not have been put back correctly.
Switch the Cables
To see if the data cable (usually SATA but can be IDE) went bad, switch it with the one connected to the hard disk drive after powering down the computer. If the Operating System loads when the data cable is switched between the hard drive and the optical drive, it indicates that the data cables are good and the issue is most likely hardware related and the optical drive will need to be repaired or replaced.
The SATA ports on the motherboard can be disabled (in the BIOS) so be sure to check the settings. SATA 0 is typically your boot drive while SATA 1 is the optical drive providing the system does not have multiple drives installed from the manufacturer. Even though multiple drives may be standard of requested during purchase, SATA 2 would likely be used for additional storage drives so that when SATA 0 is blank, SATA 1 with the Operating System will boot without the need of choosing it from the Boot Menu.