The simplest method of control of metabolism is by substrate concentration. So if the concentration of NADH and pyruvate is low, lactate dehydrogenase cannot function. When they build up it can and will.
The situation is more complicated than this, because pyruvate will only build up if it is not converted to acetyl CoA by the pyruvate dehydrogenase complex (see Berg et al. section 17.1.1):
Although the overall reaction is oxidative, and ultimately requires NAD+, the latter is not directly involved in the initial irreversible reaction. As I recall thisIt is under allosteric controlpresumably for this reason that the reaction is also controlled, either allosterically (in bacteria) or by phosphorylation (in mammals). In either case the ATP and ADP concentrationsregulators are the small molecules the concentration of which will change In these circumstancesis altered by the lack of oxygen: NAD+/NADH and ATP/ADP. The figure below and its legend is also from Berg et al. (Links to standard text description to followsection 17.2.1) — available through NCBI Bookshelf.
[The complex is inhibited by its immediate products, NADH and acetyl CoA. The pyruvate dehydrogenase component is also regulated by covalent modification. A specific kinase phosphorylates and inactivates pyruvate dehydrogenase, and a phosphatase actives the dehydrogenase by removing the phosphoryl (group). The kinase and the phosphatase also are highly regulated enzymes.]
The actual situation is quite complex and this is something of a simplification.