The Western Front descended into trench warfare after the German army was outmanoeuvred on The Marne in September 1914. From then on, a stalemate existed until mid 1918, and battle lines rarely moved more than a few miles. Trenches offered protection for troops against artillery bombardment and assault, and when further protected by barbed wire and machine guns proved very difficult for an attacking force to capture.
The picture below is of a trench occupied by the 11th Cheshire Regiment at Ovillers-la-Boisselle, on the Somme in July 1916. It’s annotated to show some of the typical features of a trench on the Western Front.