Is this a notebook or a full-size machine? DVD drives are different.
A) Press the button on the drive that opens the tray; it closes it too.
B) If it doesn't close, your drive is either broken or disconnected from the power cable. If pressing the button results in some sort of sound / shaking, you have power. If not, you might check the power.
It is possible to repair a drive tray; I did it myself last month to save a DVD player.
If it is a laptop or slim drive, there is no motor. You just push the tray in by hand until it latches closed.
On a "regular," non-slim drive, pushing the tray typically also activates the motor to close it. Don't push it so hard it breaks. If you can push it and it begins to move in but the motor doesn't come on to finish the job, that could also mean a power problem. If it doesn't move at all, it is possible there's something jammed in the gears (a staple, paper clip, snapped-off piece of pencil lead, small screw, etc. would be among the possible candidates). You'd have to take the drive out to try to [gently] shake out something like that.