Why does a polynomial with real, simple roots change its sign between its roots?
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{neg numb})(\text{neg numb})\cdots(\text{neg numb})(x-a_{n})(\text{pos numb})(\text{pos numb})\cdots(\text{pos 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 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.
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.