A sagging roof indicates that there is damage to the wood underneath the shingles. You will need to repair the roof all the way down to the wood sheathing and possibly replace some of the supporting frame. It is a project you can undertake without professional help if you have some carpentry skills, but you will need a few friends and at least a couple of days to complete it.
Remove the existing shingles. Use shovels and/or shingle scrapers to remove the shingles. Be sure to tarp the area around the house to help with clean-up, and have a dumpster on site for debris.
Remove any wet or damaged plywood. Removal of the sheathing will expose the frame construction. In most cases, damaged plywood is the main culprit of sagging.
Inspect the framing. Remove and replace any damaged boards. To limit possible damage to the structure, you can reinforce the boards with new lumber, rather than replacing, if there is limited damage. Nail or screw the new lumber to solid areas of the existing frame.
Install new plywood as needed. Use nails to secure the plywood to the frame. Small gaps between plywood sheets can be covered with shingles.
Install tar paper over all of the roof surface except the bottom 3 feet. Use ice shield to cover the bottom 3 feet if you live in a cold climate area.
Install new roof shingles. Take care to cap the shingles properly, as this is the area most susceptible to allowing water to penetrate to the wood.
For more detailed instructions on installing roof shingles, refer to the Resource link below.
Take special care with handling plywood on roofs as the wind can easily catch large sheets and pull you out of a safe position. Frame replacement is a structural change to your home and is best completed by professionals.