Condensed Answer: Lead cyclists often swerve from one side to the other to make it more difficult for those behind to draft. If a cyclist always maintains a straight line, the competitors following him can draft and attack right before the end of a sprint and win.
During a final sprint, the cyclist at the front moves from one side of the road to the other. Those behind him do their best to follow.
At first glance, swerving looks like a waste of energy and a needless complication. To the untrained eye, it appears more logical to invest all effort into riding as fast as possible without unnecessary deviations.
However, this is a necessary tactic with a logical explanation.
If the rider remains in a straight line and doesn’t switch positions, it becomes very easy for those behind him to follow while drafting and then max out in the end when the leader is tired.
Most of the pedaling effort goes towards “cutting through the atmosphere”. This is true about every vehicle including bicycles. If there was no drag, a bicycle will move at very high speeds even though it doesn’t have a motorized engine.
Drafting is a process during which a cyclist gets behind another rider or a motorized vehicle to benefit from the reduced drag. In essence, the vehicle in front acts as a shield reducing the air resistance that the cyclist would otherwise have to overcome.
A common example of dangerous drafting would following a large vehicle such as a truck very closely. Behind the truck, there’s a drag-free “pocket” which makes it very easy for a cyclist to pedal at an otherwise unreachable speed.
The same happens, but to a much smaller extent, when riding behind a motorcycle or another bicycle.
Hence why the strongest riders are often put at the front during a non-competitive group ride while the slower ones stay behind and benefit from the reduced drag.
Since leading the pack requires more energy than riding behind, the leaders are rotated to conserve energy while maintaining the high tempo of the group.
By swerving, the leading cyclist is making it more difficult for the others to ride behind him and exploit his effort.
How does a drafting cyclist benefit from following a leader?
Riding in front of a group is tiring because there’s nothing to cut the air for you. Those behind you, however, are conserving energy that can help them during the final sprint.
Hence why leaders do everything in their power to prevent others from “parasitizing”.
How Effective Is The Strategy?
Truth be told, swerving doesn’t offer as much of an advantage as one may think because the riders behind have the necessary skills and reaction time to switch directions as soon the leader has done it. Thus, the drafting can continue despite the leader’s efforts to complicate the lives of his followers.
That said, swerving is still necessary to keep the other riders in check. To a certain extent, swerving isn’t an advantage but not doing it is a disadvantage.