$ \sum_{k=0}^n x^k = \left\{ \begin{array}{ll} \frac{1-x^{n+1}}{1-x}&, \text{ if } x\neq 1\\ n+1 &, \text{ else}\end{array}\right. $
$ \sum_{k=0}^n x^k = \left\{ \begin{array}{ll} \frac{1-x^{n+1}}{1-x}&, \text{ if } x\neq 1\\ n+1 &, \text{ else}\end{array}\right. $