Here's a statement of the EVT: Let f be continuous on [a,b]. Then there exist numbers c,d\in [a,b] such that f(c)\leq f(x)\leq f(d) for all x\in [a,b]. Stated another way, the "supremum " M and "infimum " m of the range \{f(x):x\in [a,b]\} exist (they're finite) and there exist numbers c,d\in [a,b] such that f(c)=m and f(d)=M.
Note that the function f must be continuous on [a,b] for the conclusion to hold. For example, if f is a function such that f(0)=0.5, f(x)=x for 0<x<1, and f(1)=0.5, then f attains no maximum or minimum value on [0,1]. (The supremum and infimum of the range exist (they're 1 and 0, respectively), but the function never attains (never equals) these values.)
Note also that the interval must be closed. The function f(x)=x attains no maximum or minimum value on the open interval (0,1). (Once again, the supremum and infimum of the range exist (they're 1 and 0, respectively), but the function never attains (never equals) these values.)
The function f(x)=1/x also does not attain a maximum or minimum value on the open interval (0,1). Moreover, the supremum of the range does not even exist as a finite number (it's "infinity").
Here's a statement of the IVT: Let f be continuous on [a,b] and suppose f(a)!=f(b). If v is any number between f(a) and f(b), then there exists a number c\in (a,b) such that f(c)=v. Moreover, if v is a number between the supremum and infimum of the range {f(x):x\in [a,b]}, then there exists a number c\in [a,b] such that f(c)=v.
If you draw pictures of various discontinuous functions, it's pretty clear why f needs to be continuous for the IVT to be true.