The statement "Any continuous function must have a maximum on a closed bounded set" is made in these notes.
We are looking at a function $f: S\rightarrow \mathbb{R}$. I can see why closedness and boundedness are necessary but am trying to see why continuity is required to conclude that
$$\sup\limits_{S} f = \max\limits_{S} f$$
What is an example of a discontinuous function over a closed and bounded set for which the result above does not hold?
Secondly, is there an example of a discontinuous but bounded function (i.e. the range of $f$ is bounded) over a closed and bounded set for which the above result does not hold?
The supremum of the set $(a,b)$ is $b$ but the maximum does not exist you can use this to answer your question.