They just wanted to simplify the summations, so they made all of them go from 3 to n-2,
hence they expanded out whatever terms were left over, so for the first summation, they expanded out k=1 and k=2 which gives the 4 + 2 at the front.
the summations magically cancelled out which was lucky though.