How did the Union win the Battle of Gettysburg?
The Southern invasion of the North known as the Battle of Gettysburg was won by the Union, soundly defeating Pickett's Charge on the 3rd Day of Battle on July 3, 1863. This foolhardy attack was designed to force the Union to abandon their central position on the battlefield, known as Cemetery Ridge. The two previous days of battle had involved Confederate attacks on the outer Union lines, with many casualties on both sides, but the South were unable to capture the Union flank. Based on this great success, General Lee thought he would be able to crown the victory with the bold strategy above on the 3rd Day. It didn't work out that way.
This is largely due to two things; the South had fought largely defensively against Northern invasions to this point in the war, and their smoothbore weapons were better for defense. Second was because Lee underestimated the Union's ability to resupply their central lines. The first massive strikes on the 3rd Day by sustained cannon fire were largely inaccurate and failed to move the Union forces off the ridge. As the charging Confederate forces had over a mile to walk between their base and the Union position, they were prime targets for Union cannon fire, especially the dreaded "canister" fire, which was basically a giant shotgun type of fire. Failure was all but guaranteed, even though the Southern soldiers believed in the mission, few would return alive or unscathed with nearly all of the 15,000 involved in the attack killed or wounded.
Even though the Union choose not to pursue the Confederacy following the failure of Pickett's Charge, Lee agreed to retreat and fight another day. Ultimately, the battle of Gettysburg was won because of the superior defensive positions that the Union found themselves in, and the South was unable to use their often superior tactics to dislodge them. The War would continue for years to come...