I get how the formula is made. What I don't get is why whoever decided to multiply the equation by $(1-r)$. I'm referencing this link at Wikipedia. I get the mechanics, just not some of the logic.
Consider $$ \sum_{i=0}^{n-1} a^i=a^0+a^1+a^2+...+a^{n-2}+a^{n-1} $$
I get that the ratio is $r$, but why multiply this equation by $(1-r)$ and not some other quantity minus $r$?
Thanks \ AndyAndy
Actually the author is skipping a step. First you multiply the series by $r$ and then you subtract this from the original series to get that:
$$\sum_{k=1}^{n} ar^{k-1} - r\sum_{k=1}^{n} ar^{k-1} = (1-r)\sum_{k=1}^{n} ar^{k-1}$$
But expanding the left hand side we can see that lots of cancelation occurs.