What is the rule for using the formula

Sn = a(1 - r to the power of n)/1 - r

Instead of

Sn = a(r to the power of n - 1)/r - 1

I have been looking for this rule for a while in various text books and websites. Any help would be greatly appreciated.