Say we have $f(x,y) = x^2 e^{-x^2 - y^2}$ and we want to optimize it over $\mathbb{R}^2$. The minimum value is $0$ since $f(x,y) \geqslant 0$; the question is whether a maximum value exists or not.
By solving $\nabla f(x,y) = \overline{0}$ we arrive at the solutions $(x,y) = (0,t), t \in \mathbb{R}$, $(x,y) = (0,0)$ and $(x,y) = (\pm 1, 0)$. For these points, we have $f(0,t) = f(0,0) = 0$ and $f(\pm 1,0) = \frac 1e$. Among these stationary points, $\frac 1e$ is obviously the largest value attained by $f(x,y)$.
Let's now investigate $f(x,y)$ for large $x$ and $y$. We can easily show with polar coordinates that $f(x,y)\to 0$ if $\sqrt{x^2 + y^2} \to \infty$. This means by definition that
$$ \forall \epsilon, \exists \delta: \sqrt{x^2 + y^2} > \delta \implies |f(x,y)| < \epsilon $$
In particular for $\epsilon = \frac 1e$ there exists some $r_1$ such that $$|f(x,y)| < \frac 1e \quad \text{if} \quad \sqrt{x^2 + y^2} > r_1 \tag{1} $$
Assume now $\sqrt{x^2 + y^2} \geqslant r_0 > r_1$; then $(1)$ is definitely guaranteed. We can then study $f(x,y)$ on $\mathbb{D} = \{(x,y):x^2 + y^2 \leqslant r_0^2\}$. Since this is a compact set and $f$ is continuous, a minimum and maximum value exists necessarily in the set. The condition $\sqrt{x^2 + y^2} \geqslant r_0 > r_1$ together with $(1)$ tells us that on and outside the boundary of $\mathbb{D}$, $f$ is less than $\frac 1e$. Therefore $f$ must equal $\frac 1e$ somewhere inside $\mathbb{D}$.
Here's though where I am stuck. From here on, how is the argument wrapped up to ensure that $f(x,y) = \frac 1e$ is it's maximum value over whole $\mathbb{R}^2$?