To reinstall the chain on the sprocket, first with the door closed pull the rope hanging down from the trolley on the t-bar. This will release the door from the garage door opener. The chain is attached to a threaded rod that is attached to the trolley. Loosen the inside nut and back it off 6-8 turns, back the outside nut off 5-6 turns, this will give you some slack in the chain. Make sure the cable is inside the cable pulley and run the chain around the sprocket. Hold the chain to keep it from twisting and tighten the outside nut until the chain is 1/2 inch above the t-bar. Tighten the inside nut to lock it down and reattach the door to the trolley.
When the door is attached to the trolley and is open, it is normal for the chain to sag slightly.