Take the first two terms or the original equation:
(K+L)(K+M)
and expand:
KK+KM+KL+LM
According to the 'XX=X template, this becomes:
K+KM+KL+LM
According to the "X+XY=X" template, the first two terms reduce so the equation is now:
K+KL+LM
Apply that template again and you get
K+LM which is the first term of the reduced equation they give.
Repeat for the next 2 terms of the original equation and again for the last 2.
For the next line in Wikipedia, expand the first 2 terms and, applying 'XX=X', remove any duplicated letter.
The last line formed by doing the same process again.
Susan