The net gain of ATP at the end of glycolysis is 2 ATP molecules. This is calculated by the 4 ATP molecules produced during the energy payoff phase minus the 2 ATP molecules that were used in the energy investment phase.
This video explains the second phase of glycolysis, the "energy payoff phase." It details how the two glyceraldehyde-3-phosphate (G3P) molecules produced in the energy investment phase are further processed to generate ATP and NADH, ultimately resulting in two molecules of pyruvate.