The process requires 2 ATP molecules, and produces 4 ATP, giving a net gain of 2 ATP
There are two phases to glycolysis: the Investment Phase, which requires 2 ATP molecules, and the Payoff Phase, which yields 4.
In the Investment Phase, we start with glucose, a sugar with 6 carbon molecules. The process uses up two ATP molecules to add 2 phosphate groups to glucose, producing another sugar, fructose 1-6 bisphosphate. This molecule has a lot of energy stored in its chemical bonds, both from those two phosphate groups as well as the chemical bonds between those carbons.
At the start of the Payoff Phase, we break that 6-carbon molecule into two 3-carbon molecules (glyceraldehyde-3-phosphate for those who are interested). Each of those molecules, through a series of chemical reactions, is harvested of the energy stored in its chemical bonds, yielding 2 ATP molecules, for a total of 4 ATP.
So, we put 2 ATP in, but we get 4 ATP out, for a total of 2 ATP... doesn't seem like much, does it? Well, the final fate of those two molecules at the end of glycolysis is the Citric Acid Cycle and Oxidative Phosphorylation (as long as there's oxygen available), which yields a total of about 30 more ATP, from an investment of only 2!