
Some armies continued to use lances throughout this war, but they seldom saw use on the Western Front after initial clashes in France and Belgium in 1914.
Generally the troops can retreat faster than they can advance, so in an age when “breakthrough” machines (tanks, armored cars) either did not exist or were even slower than walking men, cavalry was given the task or harassing a retreating army in an attempt to turn their retreat into a rout and prevent them forming a defensive position further back. So cavalry was not meant to be charging into the teeth of machine guns, but rather charging into groups of men as they fell back, hoping to break whatever discipline they had left.
Throughout the Western Front of both sides had large bodies of cavalry on “standby” when they launched big offensives, in the hope that they could break the enemy line and the cavalry could turn a little tear in the line into a huge opening. However, from 1914-early 1917 the offensive strategy used on the Western Front undermined the ability of cavalry to fulfill this role – week-long artillery barrages gave the opposition time to prepare secondary lines of defenses and bring up reserves to fill those lines. So rather than charging into a disorganized mass of retreating men they found freshly build trenches and machine guns – exactly what they were meant to prevent. Therefore the cavalry had little use. However German lancer units were more usefully employed in the war against Russia because the battle was more fluid and less encumbered with barbed wire trenches that tied up the Western Front.