Why does a polynomial with real, simple roots change its sign between its roots? In the mathematics book I have, there is a sub-chapter called "Practical procedure to resolve inequalities" that states:  
Given a polynomial $P(x)$ that has real, simple roots, and finding the solutions to the equation $P(x) = 0$, afterwards sorting the solutions $x_1, x_2, ..., x_n$, then the sign of $P$ over an interval $(x_i, x_{i + 1})$ is the opposite of its neighboring intervals $(x_{i - 1}, x_i)$ and $(x_{i + 1}, x_{i + 2})$.  

I've plotted functions of the form $$a\prod_{i = 1}^{n}(x - a_i), \space a, a_1, a_2, ..., a_n \in [0, \infty), \space a_i \ne a_j \space \forall i, j \in \{1, 2, ..., n\} $$ 
What's an intuitive way of thinking about this and why it happens?
 A: Firstly, to simplify the problem, start by re-numbering all the $a_{i}$’s from least to greatest. Think of the behavior at $x=a_n$ notice how the polynomial will look like $$(\text{pos numb})(\text{pos numb})\cdots(\text{pos numb})(x-a_{n})(\text{neg numb})(\text{neg numb})\cdots(\text{neg numb})$$
Recall that in a series of multiplied numbers, the sign of the product is determined by whether the amount of negative numbers is even or odd. Odd making the product negative, even making it positive. Then, imagine changing $x$. Whenever it’s below $a_{n}$ there will be one more negative number than when it’s just barely above $a_{n}$ Therefore, the sign must change when passing through $x=a_{n}$
A: For a function like this, the roots are the places where the function crosses the $x$-axis, i.e. the places where it changes sign. If you think of the polynomial as the product of its linear factors and imagine how this value changes as you change $x$, you'll notice that it can only change sign (and does) when one of these factors changes sign.
A: The basic intuition is that at a root $x_0$, the graph of the function $y=p(x)$ touches the $x-$axis. Now, roots of polynomials are isolated, so that at this point the graph has to depart from the axis for the values of $p(x\pm\varepsilon)$ for small $\varepsilon$. It can go up, or down. So, there are four possibilities: $+/-$, $-/+$, $+/+$, and $-/-$, where for example $+/-$ means positive for $x_0-\varepsilon$ and negative for $x_0+\varepsilon$. There are plenty of examples of all of these behaviors. 
We can change coordinates so that $x_0=0$. Locally at $0$, $p(x)$ looks like its lowest order term. So, we can say that $p(x)\approx a_dx^d+(\text{higher order terms}).$ In the case of a simple root, $p(x)\approx ax+(\text{higher order terms})$. So, the graph looks like the graph of $y=mx$ for $m\ne 0$. In particular, for $m<0$ we have the $+/-$ situation, and for $m>0$ we have the $-/+$ situation. If the root is not simple, we can take $p(x)=x^2$ and observe that $+/+$ behavior, or $p(x)=-x^2$ for the $-/-$ behavior. However, when we have simple roots, it is always the case that the sign of the function changes locally at the root.
A: Since the roots are simple, this means that if $a$ is a root of $P(x)$ then $P'(a)\ne 0$.
Also when $P'(a)=0$ it means that it has a minimum or a maximum on this point i.e. there is a neighborhood around this point in which the functiom doesn't change sign (i.e. if it is above the $x$-axis it'll stay above it and if it is below the $x$-axis it'll stay below it in this neighborhood.
A: A polynomial has a zero in $a$ if and only if there is a (necessarily unique) polynomial $q$ such that $p(x)=(x-a)q(x)$ for all $x$. By this it follows that the zero in $a$ is simple if and only if $q(a)\ne0$, for if this weren't the case, then $q(x)=(x-a)f(x)$ and thus $p(x)=(x-a)^2f(x)$. If $a$ is a simple zero, then by continuity $q(x)$ has fixed sign in some nieghbourhood of $a$ and therefore, in said neighbourhood $$p(x)=(\text{function that changes sign at }a)\times(\text{function of fixed sign})$$
On the other hand, by the intermediate value theorem every interval where $p$ changes sign must contain a zero.
A: Suppose you have $p(x)=(x-1)(x-2)(x-3)$ .If $x<1$ then $x-1,x-2,x-3$ would be negative. If $1<x<2$ then $x-1$ is positive and the other two negative....Every time you go to the next interval you have one more positive factor of the polynomial.
A: You asked for intuitive so the following is intuitive but intuitive only.
Well if you imagine the graph as a path to follow along the graph will occasionally cross from one side of the $x$ axis to the other.  When its on the up side of the axis the value of $P$ is positive and the graph is on the down side of the axis the value of $P$ is negative. And the points where the graph is actually crossing the axis ar the points where $P$ is equal to zero.  Those are the roots.
Now for the path between the roots $P$ must stay on one side or the other.  And if this is a simple root when $P$ meets the $x$ axis, the graph will cross it and go to the other side.
Hence $P$ will go from positive in one interval to negative in the next.
The only real question is it is a simply root why does $P$ always cross?  Why doesn't the graph just meet the $x$ axis and then turn tail and go back the way it came.  Well that only occurs if that is a multiple root.
Okay.  If $P$ is the polynomial and $a$ is a root then $P(a) = 0$ and $(x-a)$ is one of the factors of $P(x)$.  So if we actually divide $(x-a)$ out of $P(x)$ we will get $P(x) = (x-a)Q(x)$.
Now if $Q(a) = 0$ then $a$ is a multiple root.  But we know it isn't so $Q(a)\ne 0$.  So either $Q(a)$ is positive or negative.  
Now let's take a really teeny interval around $a$; say the interval $(b,c)$ where $b<a < c$. And lets suppose that $b$ a $c$ are close enough to $a$ so that $Q(x)$ is never $0$ on the interval $b < x < c$.
Well then from the points just below $a$, where $b < x < a$ then $P(x)= (x- a)Q(x)$ then $x-a$ is negative.  So $P(x)$ is the opposite sign of $Q(x)$ at that point.  And for the points just above $a$ where $a < x < c$ then $(x-a)$ is positive so $P(x) = (x-a)Q(x)$ is the same sign or $Q(x)$ at that point.  But remember the interval is small enough that $Q(x)$ doesn't change signs.
So $P(x) = (x-a)Q(x)$ is one sign for $b< x < a$ and $P(x) = (x-a)Q(x)$ is the other sign for $a < x < c$.
A: Let $p(x)=(x-a)(x-b)(x-c)$; $a<b<c$, i.e. simple zeroes at $a,b,c$.
$p(a)=0$; 
$p'(a)= (a-b)(a-c) \not = 0$.
We have $p'(a)>0$. 
Since $p'$ is continuous, there is a neighborhood of $a$, $(a-\epsilon,a+\epsilon)$, where $p' >0$.
Then $p$ is strictly increasing in this neighborhood, i e
 changes sides.
Fairly straightforward to generalize to polynomials of degree $n>3$.
A: There are two ways for a function to form a root:


*

*reaching the zero value and continuing with the opposite sign;

*reaching the zero value and bouncing with the same sign.
In the first case you have an ordinary root and in the second a double root.

Technically, a (non-)change of sign can occur with a multiple root of odd (even) multiplicity.
A: The existing answers provide good intuition. On the other hand, more advanced readers might want a more rigorous point of view, and also a more general one. In the following longish post, I'll address these points.
Firstly, note the following. While a polynomial like $(x-1)(x-2)$ in which the roots are simple does indeed have the behaviour you describe, this is also true of a polynomial like $(x-1)^3(x-2)^5$, in which instead of simple roots we have (more generally) roots of odd degree. And this behaviour continues to exist if we multiply by a nowhere-vanishing factor, like $x^2 + 1$.
Most generally, if we know the multiset of (real) roots of a univariate polynomial, and if we also know the coefficient of the leading term, then we can work out exactly where the function will be positive or negative irrespective of whether the polynomial can be written wholly as a product of linear factors or not. So, this is the level of generality I suggest we work at; in high-school they sometimes call this the "sign-diagram viewpoint" or something along those lines.
Anyway, from a sign-diagram point of view, the relevant theorem is:

Theorem. If $P$ is a non-zero univariate polynomial with real coefficients, then:
$$\mathrm{sgn}(P(x)) = \mathrm{sgn}(\mathrm{lc}(P)) \cdot (\mathrm{step} \,\mathrm{roots}\, P)(x)$$

Notation used in the above theorem:

*

*$\mathrm{sgn}$ refers to the sign function

*$\mathrm{lc}(P)$ refers to the leading coefficient of $P$

*$\mathrm{roots}\, P$ refers to the multiset of roots of $P$

*If $M$ is a multiset, then $\mathrm{step} \,M : \mathbb{R} \rightarrow \{-1,0,1\}$ is a function with the property that $(\mathrm{step}\,M)(x)$ fluctuates between $1$, $0$ and $-1$ based on the number of roots to the right of $x$ in the multiset $M$. See Definition 6 below for more information.

Anyway, if you think about it, this basically answers your question (but in more generality). In particular, if all the elements of the multiset $\mathrm{roots}\, P$ have odd multiplicity, then $\mathrm{step}\, \mathrm{roots}\, P$ is going to cycle through the values $-1,0,1$ without faltering, which is what you've observed in the special case where all the elements of $\mathrm{roots}\,P$ have multiplicity $1$. With that in mind, lets prove our theorem.

Proposition 1. If $Q$ is a nowhere-vanishing continuous function $\mathbb{R} \rightarrow \mathbb{R}$, then $x \mapsto \mathrm{sgn}(Q(x))$ is a constant function.

Proof. Suppose not. Then there exist real numbers $a, b \in \mathbb{R}$ with $\mathrm{sgn}(Q(a)) \neq \mathrm{sgn}(Q(b))$. Since $Q$ is nowhere-vanishing, there's only two cases:
Case 1. $\mathrm{sgn}(Q(a)) = -1$ and $\mathrm{sgn}(Q(b)) = 1$
Case 2. $\mathrm{sgn}(Q(a)) = 1$ and $\mathrm{sgn}(Q(b)) = -1$
For Case 1, infer that $Q(a) < 0$ and $0 < Q(b)$. Hence since $Q$ is continuous, there exists $c \in [a,b]$ such that $Q(c) = 0$, by the intermediate value theorem. But this contradicts the assumption that $Q$ is nowhere vanishing. For Case 2, a similar argument suffices. $$\tag*{$\blacksquare$}$$

Definition 2. The above element of $\{-1,1\}$ is called the universal sign of $Q$ and denoted $\mathrm{usgn}\, Q$.

For example, the universal sign of $x \mapsto e^x$ is $1$, and the universal sign of $x \mapsto -e^x$ is $-1$.

Proposition 3. Given a real number $\lambda > 0$, and given also a non-empty upward-closed subset $C$ of the real line together with a function $R : C \rightarrow \mathbb{R}$ satisfying $$\mathrm{lim}_{x \rightarrow +\infty}R(x) = 0,$$ we have: $$\exists x \in C : \lambda + R(x) > 0.$$

Proof. Since $\mathrm{lim}_{x \rightarrow +\infty}R(x) = 0,$ thus $$\forall \varepsilon > 0 : \exists x \in C : \forall y \geq X : |R(y)|<\varepsilon.$$ Thus in particular $$\exists x \in C : \forall y \geq x : |R(y)|<\lambda.$$ Thus in particular, $$\exists x \in C : |R(x)|<\lambda,$$ as required. $$\tag*{$\blacksquare$}$$

Proposition 4. Given a real number $a < 0$, we have $$\mathrm{lim}_{x \rightarrow +\infty} x^a = 0$$

Proof. It's enough to show that $$\mathrm{lim}_{x \rightarrow +\infty} x^{-a} = +\infty.$$ Since $a < 0$, hence $-a > 0$. Thus it's clear that $x^{-a}$ is an increasing function. Hence it's enough to show that $x^{-a}$ is unbounded. Thus it's enough to show that $x \in \mathbb{R}_{>0} \mapsto x^{-a}$ has an inverse function. Thus it's enough to show that the inverse of $x \in \mathbb{R}_{>0} \mapsto x^{-a}$ is $x \in \mathbb{R}_{>0} \mapsto x^{-1/a}.$ But this is easily demonstrated by elementary arithmetic. $$\tag*{$\blacksquare$}$$

Proposition 5. If $Q$ is a nowhere-vanishing univariate polynomial with real coefficients, then $\mathrm{usgn}\, Q = \mathrm{sgn}(\mathrm{lc}(Q)),$ where $\mathrm{lc}(Q)$ refers to the leading coefficient of $Q$.

Proof. There are two cases, namely $\mathrm{lc}(Q)>0$ and $\mathrm{lc}(Q)<0.$ We'll prove the result in the first case; the proof in the second case is similar. Thus our goal is to show that $\mathrm{usgn}\, Q = 1.$ It's enough to prove $$\exists x \in \mathbb{R} : Q(x) > 0.$$
We know that we can write $Q$ as its leading term plus the remaining terms, like so: $$Q(x) = \mathrm{lc}(Q)x^{\mathrm{deg}(Q)} + \sum_{i = 0}^{\mathrm{deg}(Q)-1} a_i x^i$$
Thus for $x \neq 0$, we have:
$$Q(x) = x^{\mathrm{deg}(Q)}
\left(\mathrm{lc}(Q) + \sum_{i = 0}^{\mathrm{deg}(Q)-1} a_i x^{i-\mathrm{deg}(Q)}\right)$$
So our goal is to show that $$\exists x \in \mathbb{R}_{\neq 0} : x^{\mathrm{deg}(Q)}
\left(\mathrm{lc}(Q) + \sum_{i = 0}^{\mathrm{deg}(Q)-1} a_i x^{i-\mathrm{deg}(Q)}\right) > 0.$$
Note that if $x > 0$, then $x^{\mathrm{deg}(Q)}$ is automatically positive. Thus it's enough to show that $$\exists x \in \mathbb{R}_{\neq 0} : \mathrm{lc}(Q) + \sum_{i = 0}^{\mathrm{deg}(Q)-1} a_i x^{i-\mathrm{deg}(Q)} > 0.$$
Since $\mathrm{lc}(Q) > 0$ by hypothesis, we can invoke Proposition 3 above. It's therefore enough to show $$\lim_{x \rightarrow +\infty} \sum_{i = 0}^{\mathrm{deg}(Q)-1} a_i x^{i-\mathrm{deg}(Q)} = 0.$$ Hence it's enough to show that $$\sum_{i = 0}^{\mathrm{deg}(Q)-1} \lim_{x \rightarrow +\infty} a_i x^{i-\mathrm{deg}(Q)} = 0.$$ Hence it's enough to show that $$\forall_{i = 0}^{\mathrm{deg}(Q)-1} \lim_{x \rightarrow +\infty} a_i x^{i-\mathrm{deg}(Q)} = 0.$$
So consider $i \in \{0,\ldots,\mathrm{deg}(Q)-1\}.$ Our goal is to show that $\lim_{x \rightarrow +\infty} a_i x^{i-\mathrm{deg}(Q)} = 0.$ It's enough to show that $\lim_{x \rightarrow +\infty} x^{i-\mathrm{deg}(Q)} = 0.$ Thus by Proposition 4, it's enough to show that $i-\mathrm{deg}(Q) < 0.$ But since $i \leq \mathrm{deg}(Q)-1$, and since $\mathrm{deg}(Q)-1 < \mathrm{deg}(Q)$, hence this completes the proof. $$\tag*{$\blacksquare$}$$

Definition 6. If $M$ is a multiset of real numbers, we get an associated function $\mathrm{step} \,M : \mathbb{R} \rightarrow \{-1,0,1\}$ defined as follows: $$(\mathrm{step} \,M)(x) = 0 \mbox{ if } x \in M$$
$$(\mathrm{step} \,M)(x) = \prod_{a \in M : a > x} (-1) \mbox{ if } x \notin M$$

For example, if $M = 0$, then $\mathrm{step} \,M$ is $1$ everywhere. If $M = \langle a\rangle$, then $\mathrm{step} \,M$ takes the value $-1$ to the left of $a$ and $+1$ to the right of $a$, and take the value $0$ at $a$. If it's still not clear what $\mathrm{step} M$ looks like in general, think about the multset $M = \langle a \rangle + \langle b \rangle$ in the cases $a < b$ and $a = b$ respectively.

Proposition 7. If $M$ is a multiset of real numbers, then $$(\mathrm{step} \,M)(x) = \prod_{a \in M} \mathrm{sgn}(x-a)$$

Proof. There are two cases.
First case. Assume $x \in M$, this just means that $\exists a \in M : x = a$. Hence $\exists a \in M : x - a = 0$. Hence $\exists a \in M : \mathrm{sgn}(x - a) = 0.$ Hence $$\prod_{a \in M} \mathrm{sgn}(x-a) = 0.$$
Thus $$\prod_{a \in M} \mathrm{sgn}(x-a) = (\mathrm{step} \,M)(x),$$ as required.
Second case. Assume $x \notin M$. Then $\forall a \in M : x \neq a$. Thus $\forall a \in M : x - a \neq 0$. Thus $\forall a \in M : \mathrm{sgn}(x - a) \in \{-1,1\}$. Thus $$\prod_{a \in M} \mathrm{sgn}(x - a) = \prod_{a \in M : \mathrm{sgn}(x - a) = -1} -1 = \prod_{a \in M : a>x} -1.$$ Thus $$\prod_{a \in M} \mathrm{sgn}(x-a) = (\mathrm{step} \,M)(x),$$ as required. $$\tag*{$\blacksquare$}$$

Theorem 8. If $P$ is a non-zero univariate polynomial with real coefficients whose leading term is positive, then:
$$\mathrm{sgn}(P(x)) = \mathrm{sgn}(\mathrm{lc}(P)) \cdot (\mathrm{step} \,\mathrm{roots}\, P)(x)$$

Proof. Since $Q$ is a non-zero univariate polynomial with real coefficients, hence there exists a nowhere-vanishing univariate polynomial $Q$ with real coefficients satisfying the following equation:
$$P(x) = Q(x)\prod_{a \in \mathrm{roots}\, P} (x - a).$$ Taking $\mathrm{sgn}$ of both sides, we see that $$\mathrm{sgn}(P(x)) = \mathrm{sgn}(Q(x))\prod_{a \in \mathrm{roots}\, P} \mathrm{sgn}(x - a).$$ By Proposition 6, this implies $$\mathrm{sgn}(P(x)) = \mathrm{sgn}(Q(x))(\mathrm{step} \,\mathrm{roots}\, P)(x).$$
Hence it's enough to show that $\mathrm{sgn}(Q(x)) = \mathrm{sgn}(\mathrm{lc}(P)).$ By Proposition 1/Definition 2, we know that $\mathrm{sgn}(Q(x)) = \mathrm{usgn}(Q),$ and by Proposition 5, we know that $\mathrm{usgn}(Q) = \mathrm{sgn}(\mathrm{lc}(Q)).$ Hence it's enough to show that $$\mathrm{sgn}(\mathrm{lc}(P)) = \mathrm{sgn}(\mathrm{lc}(Q)).$$ Thus it's enough to show that $\mathrm{lc}(P) = \mathrm{lc}(Q)$. Recall also that $$P(x) = Q(x)\prod_{a \in \mathrm{roots}\, P} (x - a).$$ Hence $$\mathrm{lc}(P) = \mathrm{lc}(Q)\prod_{a \in \mathrm{roots}\, P} \mathrm{lc}(x \mapsto x - a).$$ Thus $$\mathrm{lc}(P) = \mathrm{lc}(Q)\prod_{a \in \mathrm{roots}\, P} 1.$$ Thus $\mathrm{lc}(P) = \mathrm{lc}(Q)$, as desired. $$\tag*{$\blacksquare$}$$
