Consider $f(x)=(x^2+2)x(x-2)$. It has two real roots: $0$ and $2$.

If $x<0$, then $f(x)$ is positive, and if $x>2$, then also $f(x)$ is positive.

If $x$ is in $(0,2)$, then $f(x)$ is negative.

I am trying to understand why $f(x)$ has unique local minima in the interval $(0,2)$, so that the graph of $f(x)$ in interval $(0,2)$ is U-shaped. Can one explain, why this happens?

Even if we modify $f(x)$ by
$$f(x)=(x^2+2)x(x-2)(x-4)\cdots (x-2n)$$
still, in each interval of the form $(2k, 2k+2)$, the graph of $f(x)$ is U-shaped or reverse-U shaped.

Why it can't be (smooth) w-shaped? Why this is happening?