The Custodian is correct in stating that trench warfare was a result of the superiority of the defense. The problem faced by the generals was that
machine guns,
barbed wire and
mud conspired to make any unprotected movement too expensive in human life to be practiceable. Not enough soldiers could cross
no man's land to make a difference. The most pointed example came during the opening days of the
First Battle of the Somme where 20,000 British infantrymen died within one hour.
Trench warfare first appeared late in the American Civil War, most notably during the siege of Petersburg. Combat Experience gained in that war taught that troops simply could not successfully assault a properly manned and supported trench line. The cost was too great. World War I generals greatly downrated the American experience during the Civil War. Part of the reason was European snobbery, but the more professional reason was that breech-loading guns had revolutionized artillery in the latter half of the 19th century. Union and Confederate armies had relied upon what were essentially Napoleonic guns throughout that conflict. With the new guns, Generals planned to have artillery fire blast a hole in enemy lines. It was hoped this would create a breakthrough, which would restore a war of movement. Battles would become meeting engagements. Battles would become less deadly and potentially decisive.
The problem with that strategy was threefold. First, the heavy artillery barrage alerted the enemy, who could begin moving reserves to plug any gaps. The second and more important reason was that the given horse-drawn transport and footpower of the era, the cratering and mud created by the barrage rendered the battlefield nearly impassable. The attacker had to cross destroyed terrain before he could reach open country, and exploit his breakthrough. Conversely, the defender could move across unbroken terrain to reinforce. The defender was always able to move faster, and thus re-establish a defensive line. Finally, the barrages effectively destroyed any communications between the attackers and front lines. Even wires buried six feet deep (the practical minimum) could not survive a heavy bombardment. Radio communications did not exist. As attackers advanced they lost all ability to communicate with their rear. Reinforcements could not be summoned to exploit success. Artillery fire could not be adjusted to the current situation. Once infantrymen 'crossed the line' they were entirely out of contact with the back. The result was a reliance on overly-rigid plans that never survived contact with the enemy.
Two solutions appeared during the war. The first was the German Stormtroopers, who appeared very late in the war. These were picked troops who practiced infiltration tactics. Stormtroopers attacked with little or no preparatory bombardment. Their tactics stressed speed. Enemy defence lines were bypassed with the enemy rear the primary objective. Limited moving barrages and close air support was used once the engagement began, making the effort an early use of combined arms operations. Stormtrooper tactics enjoyed some successes, but the tactic was too expensive in manpower. Also withdrawing so many picked troops from the line to make up Stormtrooper battalions significantly weakened regular army units.
The second, and more successful, solution was the tank. When combined with aircraft, concentrated artillery support and what became known as Bite and Hold tactics, where the idea was to grab key terrain and then beat off the inevitable counterattack. New tactics were one big reason for the German surrender in 1918.
Noders wishing more information are strongly suggested to read: Bryan Perret A Short History of Blitzkrieg and Basil Liddell-Hart Strategy
I have personally walked a small section of trench preserved at the Canadian battlefield at Vimy Ridge. They have a preserved bomb shelters and a sapper tunnel, which you can tour. I also interviewed a few veterans of that war, one of whom shared his war photos with me. No man's land is now green with grass, where it would have been soft mud back in 1916. No grass would have survived. But I could easily see how difficult an infantry assault would have been even today. These were brave men on both sides of that line.