Key is to remember the formula Distance = Rate * Time (d=rt)
The question asks us to find the rate over the entire trip, so we'll need to know two things: (1) the distance of the whole trip and (2) the time taken to drive the entire distance.
(1) Distance:
The question stem gives the distances of both portions of the trip, 40mi and 180mi. Adding the two together gives us the total distance: 220mi.
(2) Time:
The information in the passage doesn't give us time for each portion explicitly, but since we know the distance and rate for each part of the trip we can use the formula above to determine the time.
Trip one - 40mi = 20mph * time time = 2hr
Trip two - 180mi = 60mph * time time = 3hr
Total trip time = 5 hours
Now that we have the distance and time for the entire trip we can use d=rt to solve for the rate