John Pope has the presence of mind to plug Thoroughfare Gap with a strong force, thus preventing the corps of Jackson and Longstreet from uniting during the Second Manassas Campaign. Even with a somewhat bumbling leader and disjointed command structure, the Union forces are able to grind Jackson down and wreck his force. Left with only Longstreet's corps, Lee either retreats back towards Richmond or fights a losing battle himself.
With Pope's victory coming on the heels of McClellan's failure on the Peninsula, Lincoln has enough political capital to sack the latter in favor of the former. There is plenty of time for another campaign before the winter sets in. With the Army of Northern Virginia in tatters and the confident Union forces reunited around Fredericksburg, Pope stands a good chance of capturing Richmond before the end of the year.
Pope is hailed by history as a great general and Lee as a reckless fool.