If necessary, recall that $$ \ell^2 = \{x=\{x_n\}_n\subset \mathbb{R} : \|x\|^2:=\sum_n |x|^2<\infty\} $$
and $ \overline{B_1(0)} $ is the closed unit ball with respect to that norm.
Can we find an explicit example of a continuous function $f: \overline{B_1(0)} \subset \ell^2\to \mathbb{R}$ which does not attain its maximum?
The point is that this ball is not a compact set.
Thank you.
Try $$f(x) = \sum_{n=1}^\infty (1-1/n) x_n^2$$ Note that $f(x) < 1$ for all $x \in \overline{B_1(0)}$, and you can get arbitrarily close to $1$...