What type of warfare kept World War I at a stalemate for the first few years of fighting?
I would say Trench Warfare.
This kind of warfare is based upon the construction of fixed defensive position where soldiers can shelter in trenches and be protected from enemy fire while preparing an attack.
The problem is that this idea works for both sides and in WWI soon led to a stalemate situation where as in a game of chess the "moves" of attacking and defending were "played" continuously and alternately without actual gain or victory.
A typical example is the battle of Verdun: this battle, fought for the capture of the fortress/town of Verdun, was aimed at killing as many soldiers as possible on both sides and resulted in....nothing! It is only remembered as a huge massacre with absolutely no military meaning.