Start with this:

Let S = 1 + q + q^2 + q^3 + ... + q^(n-1)

Sq = q + q^2 + q^3 +q^4 + ... + q^(n-1) + q^n

But that looks pretty close to what S was. In fact:

Sq = S + q^n - 1

Now just solve

Sq - S = q^n - 1

S(q-1) = q^n - 1

S = (q^n - 1)/(q-1)

Now do the same type of thing with your equation and remember the result we just got because you will see it pop out.

Let S = 1 + q + q^2 + q^3 + ... + q^(n-1)

Sq = q + q^2 + q^3 +q^4 + ... + q^(n-1) + q^n

But that looks pretty close to what S was. In fact:

Sq = S + q^n - 1

Now just solve

Sq - S = q^n - 1

S(q-1) = q^n - 1

S = (q^n - 1)/(q-1)

Now do the same type of thing with your equation and remember the result we just got because you will see it pop out.