Why does f' = 0 gives the min or max? I understand how to calculate it, but I am just curious, why actually it works? Do we have a proof that it always works?

Consider the case where a differentiable function $f(x)$ has a minimum at the point $x_{0}$. By definition, there exists a $\epsilon-$neighborhood
$$
  x = \left\{ x\in\mathbb{R} \colon \left| x - x_{0} \right| < \epsilon \right\}
$$ 
with $\epsilon>0$ where $f(x) > f(x_{0})$.
If we constrain $\delta < \epsilon$, then 
$$
\frac{f(x+\delta) - f(x)} {\delta} > 0.
$$
So within the $\epsilon-$neighborhood, a $\delta-$sequence produces a limit which approaches 0 from above.
A similar argument holds for approaching the minimum from the left.
