Yes, glycolysis can occur in the absence of oxygen, with the production of 2 ATP. However, the NAD+ used in glycolysis, has become NADH and must be returned to its original NAD+. Usually carrying electrons to the electron transport chain takes care of that. But in the absence of oxygen, cellular respiration cannot continue, so the cell would eventually run out of NAD+ and glycolysis would stop.
Fortunately, many cells have an alternative to regenerating NAD+, called fermentation. Whether it is lactic fermentation or alcoholic fermentation, the purpose of fermentation is NOT the production of ATP (fermentation does not produce any) but the REGENERATION of NAD+ so that glycolysis can continue.
As a curiosity, some cells do not perform fermentation. Think on cardiac muscle cells. When a coronary vessel is blocked, cardiac muscle cells lack sufficient oxygen, but because they do not perform fermentation, they eventually die. That is what a heart attack is! But the muscle cells in your legs can perform fermentation and continue working even though the amount of energy produced is greatly reduced. This is what long distance runners know as "hitting the brick wall". They can barely walk, let alone run. I have seen plenty of 1 mile runners, who are not conditioned enough, lose a race at the end of the last lap.