The ATP in glycolysis is produced directly in certain reactions, of the most important beingtype:
X-PO32– + ADP → Y + ATP
in a process is called substrate-level phosphorylation.
A key preceding reaction in the pathway is the one catalysed by glyceraldehyde 3-phosphate dehydrogenase, in which free orthophosphate is incorporated into a sugar phosphate in a reaction of the type:
Z + PO43– → X-PO32–
(I have used X, Y and Z because other changes occur in the structures. The process)
This is calledtotally different from the substrate-leveloxidative phosphorylation —that occurs in the mitochondrion. In both cases the (free) energy driving the generation of ATP comes from oxidation of sugars involving cofactors such as opposedNAD+ to NADH. In oxidative phosphorylation the reoxidation of NADH in the mitochondrion — andmembrane (ultimately by molecular oxygen) is totally different fromused to set up a proton gradient, which can then be used to drive the ATP-synthase. In substrate-level phosphorylation the chemistry of the intermediates is manipulated so that particular reactions involve sufficient free energy change to drive the conversion of ADP to ATP directly. (The anaerobic reoxidation of the NADH does not produce ATP in this latter case.)
You should read a text-book of biochemistry for the details, which are too extensive and basic to present here. Berg et al. Section 16.1 covers this well, and is available on-line.