Find the emergency release rope. This rope is distinctively red and drops down from the garage door assembly overhead. Pull on this rope. This will disengage the garage's jammed motor.
Move over to the garage door and look on the inside of the door. There will be an inner handle you can grab. If the door became stuck as you attempted to shut it, shut it completely yourself by slowly pulling down on the inner handle. The motor is completely disengaged, so do not jerk down on the handle, otherwise you risk damaging your door. Instead, "walk" the garage door slowly down until it closes.
Return to the emergency release rope for your garage door. Pull this rope at a 45-degree angle to re-engage the motor. Wait as the garage door's chain resets itself.
Press the button on your garage door's electronic opener to test the motor. The door will no longer be jammed and it will open and shut electronically as it should.