They are using the formula for the sum of a geometric progression $$a+ar+ar^2+\cdots+ar^n=\frac{a(r^{n+1}-1)}{r-1}\qquad \left(\text{which is equal to }\frac{a(1-r^{n+1})}{1-r}\right)$$ which follows from simply multiplying: $$\begin{align*}(a+ar+ar^2+\cdots+ar^n)(r-1)&=\;\;\;\;\;\;\;\;\;\,\,ar+ar^2+ar^3+\cdots+ar^{n+1}\\\ &\hphantom{=}-(a+ar+ar^2+\cdots+ ar^n)\\\\[0.05in] &=-a+ar^{n+1}\\\\[0.05in] &=a(r^{n+1}-1)\end{align*}$$ The formula you are thinking of is the formula for the sum of the entire series $$\sum_{n=0}^\infty ar^n=\frac{a}{1-r},\qquad |r|<1$$ You can see there is a relationship between these two formulas. If the number $r$ is strictly between $1$ and $-1$, then letting $n$ "go to infinity", the number $r^{n+1}$ will become $0$, which turns the expression $$\frac{a(1-r^{n+1})}{1-r}$$ into $$\frac{a}{1-r}.$$