How does the body switch between aerobic and anaerobic respiration?
The simple answer to your question is that in the absence of oxygen the electron transport chain stops. (It can't go backwards, that would generate oxygen.) However your assumption that it stops at the last step is incorrect, all the cytochromes are converted to their reduced form, and there is feedback that diverts the NADH elsewhere. 

The situation is complicated because it depends what tissue you are talking about and what sort of exercise and what is the fuel for respiration. However let us consider the skeletal muscle at the start of a non-sprint run. Let us assume that it will be using glycogen as a source of fuel, which is converted to pyruvate and NADH. The pyruvate will enter the tricarboxylic acid (TCA) cycle in the mitochondria and be oxidized there and also produce metabolites. The NADH from glycolysis (produced by reducing NAD+) will enter the mitochondria and be oxidized; however it does not enter directly but via a shuttle, one of which — the malate-aspartate shuttle, show below — will be considered in a more detail lower down.

Now let us suppose there is a sudden need to sprint so that the muscle cannot get sufficient oxygen to deal with the NADH produced in glycolysis. What happens? The key event is that pyruvate is oxidized to lactate. Why? Not because lactate is useful, but because this is an anaerobic means of oxidizing the NADH back to NAD+ to allow glycolysis to continue and ATP to be produced at the substrate level.

Why doesn't the NADH keep going into the mitochondria (where it would be wasted as the electron transport chain has stopped)? Because the shuttle stops — in the case of the malate-aspartate shuttle mitochondrial malate dehydrogenase stops converting malate to oxaloacetate, malate builds up and therefore the malate transporter stops bringing malate into the mitochondrion. 



This can be understood at the most general level by the fact that if NADH in the mitochondrion cannot be oxidized it will accumulate, hence slowing and eventually arresting the malate dehydrogenase reaction by simple mass action. 

In fact Nature generally uses more sophisticated regulation that allows switch on and switch off to be performed more rapidly and completely, most notably by allosteric regulators. In the case of malate dehydrogenase the situation is not really clear, but there are reports that suggests citrate is an allosteric activator of the enzyme in some tissues (http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1131027/). The concentration of citrate falls as the TCA cycle stops because of the lack of NAD+ (this is because TCA cycle intermediates get tapped off for other purposes) so the activating effect of this intermediate would be removed.

(There is another shuttle for reducing power that my be more important in skeletal muscle. This is the glycerol 3-phosphate shuttle. However as this requires the oxidized form of FAD directly in the mitochondrial membrane it will clearly shut down in anoxia.)

The net result is that the NADH stays in the cytosol to be oxidized by pyruvate in the lactate dehydrogenase reaction.

This can only happen if the pyruvate stays in the cytoplasm and does not move to the mitochondrion. Obviously the lack of NADH to reduce it to acetyl-CoA in the pyruvate dehydrogenase reaction would cause its concentration to build up in the mitochondrion and reduce transport across the membrane by simple mass action. However it is likely that the specific mitochondrial pyruvate transporter is regulated by metabolites which change their concentration under these conditions. The evidence here is indirect as the transporter was only identified and cloned in 2012.