On the bottom, you do not have the equivalent of S-aS shown for the P equation. The answer lies in what would be on the left hand side.
The above starts with S=1 + a^2 + a^3 + ... + a^n.
I understand how the first part (dealing with S) works but I dont understand how it relates to the expression below the paragraph.
in the second expression after the paragraph must correspond with and must correspond to
but im not sure what role the first term: plays or how we get to the third expression at the bottom.