No O2: glycolysis occurs but via fermentation pathways...producing lactic acid or ethanol. These pathways reproduce the NAD+ needed continue with the glycolytic pathway. The ATP yield of anerobic glycolytic respiration is 2 ATP.
Jack is right. O2 is not needed for glycolysis itself. Glycolysis yields 2 ATP and 2 NADH. In the absense of O2, glycolysis goes into a fermentation pathway producing lactic acid or ethanol. O2 is needed for the electron acceptor during oxidative phosphorylation.
Just some additional info...In the absence of O2, glycolysis is the main producer of ATP (quick, but low yeild of ATP), along with fermentation to produce 2 more ATP and catabolize pyruvate to ethanol/lactic acid. This can be the primary source of energy in an organism (anerobic bacteria-I think O2 is actually harmful to these bacteria if I remember correctly) or glycolysis can function mainly as a producer of 2 pyruvate that can undergo aerobic respiration, with the ATP (and NADH) generated by glycolysis just being frosting on the cake. However if the source of O2 can not keep up with aerobic respiration (ie. strenuous activity), the system backs up and the pyruvate produced from glycolysis undergoes fermentation to lactic acid (ie. why your muscles get sore after said strenuous activity)