I can see why this works for a root $p$ with multiplicity $k\geq 1$, when $f(x)=(x-p)^k$.
But, why is that true if $f(x)=(x-x_1)(x-x_2)\cdots(x-x_n)$ has distinct roots $x_1\neq x_2\neq \cdots \neq x_n$?
Is it something to do with Lagrange's Mean Value Theorem?