How to get from $x^{p-1}-1$ to $(x-1)(x^{p-2}+x^{p-3}+\cdots+x+1)$? How would I get from $x^{p-1}-1$ to $(x-1)(x^{p-2}+x^{p-3}+\cdots+x+1)$? 
It make sense to me logically. When one multiplies it out, it would condense to $x^{p-1}-1$. But it's just not clicking. What is the arithmetic between these steps?
 A: Just do it
$$(x-1)(x^{p-2}+x^{p-3}+\cdots+x+1)=$$
$$=x\cdot(x^{p-2}+x^{p-3}+\cdots+x+1)-1\cdot (x^{p-2}+x^{p-3}+\cdots+x+1)=$$
$$=(x^{p-1}+x^{p-2}+\cdots+x^2+x)-(x^{p-2}+x^{p-3}+\cdots+x+1)=$$
$$=x^{p-1}\color{red}{+x^{p-2}-x^{p-2}+\ldots+x-x}-1=$$$$=x^{p-1}-1$$
A: It comes from the high-school formula used for the sum of a geometric series. It relies on this factorisation identity, often used as a model for proofs by induction:
$$ a^n -b^n=(a-b)(a^{n-1}+a^{n-2}b+\dots+ab^{n-2}+b^{n-1}) $$
The inductive step is as follows:
 \begin{align}
a^{n+1}-b^{n+1}&=(a^{n+1}-a^{n}b)+(a^{n}b-b^{n+1}) \\
&=a^{n}(a-b)+b(a^{n}-b^n)=a^{n}(a-b)+b(a-b)(a^{n-1}+a^{n-2}b+\dots+ab^{n-2}+b^{n-1}) \\
&=(a-b)\bigl(a^n+b(a^{n-1}+a^{n-2}b+\dots+ab^{n-2}+b^{n-1})\bigr) \\
&=(a-b)(a^n+a^{n-1}b+a^{n-2}b^2+\dots+ab^{n-1}+b^n).
\end{align}
For the case at hand, replace $a$ and $b$ with $x$ and $1$ respectively.
A: Observe that $x^{p-2}+x^{p-3}+\dots+x+1=\sum_{i=0}^{p-2}x^i$.  Now, observe that
$$
(x-1)(x^{p-2}+x^{p-3}+\dots+x+1)=(x-1)\sum_{i=0}^{p-2}x^i=\sum_{i=0}^{p-2}x^{i+1}-\sum_{i=0}^{p-2}x^i.
$$
Reindexing the first sum ($j=i+1$), we get that this equals
$$
\sum_{j=1}^{p-1}x^j-\sum_{i=0}^{p-2}x^i.
$$
Now, if we peel off the last term of the first sum and the first term of the second sum, we get
$$
\left(x^{p-1}+\sum_{j=1}^{p-2}x^j\right)-\left(\sum_{j=1}^{p-2}x^j+x^0\right).
$$
Since the sums cancel, we are left with $x^{p-1}-x^0=x^{p-1}-1$.
If you want to derive the formula, Berci's comment above about using the polynomial division algorithm should work well.
A: First of all, we might as well set
$n = p - 1, \tag 1$
and then investigate the equation
$x^n - 1 \overset{?}{=} (x - 1)(x^{n - 1} + x^{n - 2} + \ldots + x + 1) = (x - 1)\displaystyle \sum_0^{n - 1} x^i. \tag 2$
One may in fact use a simple induction to validate (2); we check
$n = 1: \; x^1 - 1 = x^1 - 1 = (x - 1) \displaystyle \sum_0^0 x^i, \tag 3$
$n = 2: \; x^2 - 1 = (x - 1)(x + 1) = (x - 1)\displaystyle \sum_0^1 x^i, \tag 4$
$n = 3: \; x^3 - 1 = (x - 1)(x^2 + x + 1) = (x - 1)\displaystyle \sum_0^2 x^i;  \tag 5$
now if
$\exists k \in \Bbb N, \; x^k - 1 = (x - 1)\displaystyle \sum_0^{k - 1} x ^i, \tag 6$
we have
$x^{k + 1} - 1 = x^{k + 1} - x^k + x^k - 1 = (x - 1)x ^k + x^k - 1, \tag 7$
and then using (6),
$x^{k + 1} - 1 = (x - 1)x ^k + (x - 1)\displaystyle \sum_0^{k - 1} x ^i, \tag 8$
whence
$x^{k + 1} - 1 = (x - 1) \left (x ^k + \displaystyle \sum_0^{k - 1} x ^i \right ) = (x - 1) \displaystyle \sum_0^k x ^i, \tag 9$
which shows inductively that (2) must bind.
As far as performing the actual aritmetical/algebraic operations required above is concerned, it is easy to write them out explicitly for equations (3)-(5), viz
$(x - 1)(x + 1) = x(x + 1) - 1(x + 1) = x^2 + x - x - 1 = x^2 - 1; \tag{10}$
it is apparent that the distributive law is used critically here, allowing us as it does to write both the first equality in (10) as well as
$x(x + 1) = x^2 + x \; \text{etc}; \tag{11}$
in fact, the distributive law is tacitly invoked in (7)-(9); indeed, it plays a central role in performing the arithmetic necessary to establish (2).
A: I'm not sure if this fully answers your question, however, when I am factoring higher degree polynomials (degree greater than 2) I often like to use the following trick that I will demonstrate below:
On polynomials like the one you have there, it is easy to see that $x=1$ is a zero of the polynomial $x^{p-1}-1$. Then you want to use the following trick where you kind of 'reverse' expand the polynomial:
\begin{align}
x^{p-1} - 1 &= x^{p-1} - x^{p-2} + x^{p-2} - x^{p-3} + x^{p-3} -...- x + x - 1 \\
&=  (x^{p-1} + x^{p-2} + x^{p-3} + ... + x) - (x^{p-2} + x^{p-3} + x^{p-4} +...+ 1) \\
&= x(x^{p-2} + x^{p-3} + x^{p-4} +...+ 1) - (x^{p-2} + x^{p-3} + x^{p-4} +...+ 1) \\
&= (x-1)(x^{p-2} + x^{p-3} + x^{p-4} +...+ 1) \\
\end{align}
So you basically add and subtract terms without changing the polynomial so it is easy to pull out the $(x-1)$ factor. Just as another example to better illustrate the technique on a polynomial you don't know the factors of:
Lets say we wanted to factor the polynomial $x^3 -9x^2 +26x -24$. With some quick trial and error you can find that $x=2$ is a zero of the polynomial. Then, as before, you want to rearrange the polynomial so that it easy to pull out the $(x-2)$ factor. We do it as follows:
\begin{align}
x^3 -9x^2 +26x -24 &= x^3 - 2x^2 - 7x^2 + 14x + 12x - 24 \\
&= (x^3 - 7x^2 + 12x) - (2x^2 - 14x +24) \\
&= x(x^2 -7x +12) - 2(x^2 - 7x + 12) \\
&= (x-2)(x^2 -7x +12)\\
\end{align}
So all we have done is leave the highest/lowest degree terms alone and split the middle terms into two parts, one a multiple of $x$ and the other a multiple of -2. It is then easy to rearrange the polynomial and factor out the $(x-2)$ factor. You can apply this technique to any polynomial that you already know a zero of, however, as you can imagine it gets messy if the zeroes of the polynomial aren't 'small' integers.
