The Extreme Value Theorem tells us that the minimum and maximum
of a function have to be somewhere. But where should we look?
The answer lies in the third of the Six Pillars of Calculus:

What goes up has to stop before it comes down.

Fermat's Theorem

Places where the derivative either

Equals zero, or

Does not exist

are called critical points, or
critical values.
That's what has to happen at the top of the function's arc!
In other words,
only critical points and endpoints can be absolute maxima or minima.

This is the idea behind one of Fermat's theorems:

Fermat's Theorem: Suppose
that $a \lt c \lt b$. If a function $f$ is defined on the interval
$(a,b)$, and it has a maximum or a minimum at $c$, then either $f'$ doesn't exist at $c$ or $f'(c)=0$.

Equivalently, if $f'(c)$ exists and is not zero, then $f(c)$ is neither
a maximum nor a minimum.