TITLE: Why isn't $(0,1]$ compact?
QUESTION [8 upvotes]: It is said that $$\bigcup_{n\geq 1}\left(\frac 1n, 1+\frac1n\right)$$ is not compact.
Why?
Is it because it is not closed? 
Or am I missing something more?
Many thanks.

REPLY [34 votes]: Here are four ways to see that $(0,1]$ is not compact.

The open cover you gave for $(0,1]$ (namely $\{(1/n,1+1/n)\,:n\in\mathbb N\}$ does not have any finite subset which covers $(0,1]$ (in other words, does not have a finite subcover). I think this is the reason you were looking for, as user44441 said.
A subset of $\mathbb R^n$ is compact if and only if it is closed and bounded. $(0,1]$ is not closed (although it is bounded).
Expanding on LAcarguy's comment, in a metric space ($\mathbb R$ is a metric space) a subset is compact if and only if it is sequentially compact: every sequence of the subset has a convergent subsequence. The sequence $1,1/2,1/3,\dots$ is contained in $S$ but each of its subsequences converges to $0$ and $0\notin(0,1]$.
If $(0,1]$ were compact, it would be true that every continuous function $f: (0,1]\to\mathbb R$ attains a maximum and a minimum. But the function $f(x)=1/x$ defined on $(0,1]$ is continuous and unbounded.