Example of Heine-Borel Theorem For a subset $S$ of Euclidean space $\mathbb R^n$,

S is closed and bounded if and only if
  S is compact (that is, every open cover of $S$ has a finite subcover).

I need an example or application of this theorem to understand it well. Could you please give one?
 A: The Heine-Borel theorem plays a crucial role in the development of both Riemann and Lebesgue integration on $\mathbb{R}^d$.
Perhaps the most important result in Riemann integration is that continuous functions on closed intervals $[a,b]$ are integrable. The reason is that $[a,b]$ is compact by Heine-Borel, so continuous functions on it are uniformly continuous, and uniformly continuous functions are well approximated by their value at finitely many points.
In Lebesgue integration, the Heine-Borel theorem is the fundamental fact about geometry of Euclidean space that makes a lot of the crucial lemmas work. For instance, the Lebesgue measure of a closed interval $[a,b]$ had better be $b-a$. If you look at the definition of the Lebesgue measure, you'll see it has to do with countable coverings of sets, and the Heine-Borel theorem allows us to replace those countable coverings of $[a,b]$ with finite ones. That's what makes the proof work. 
It's also important in the proof of the mean value theorem. When you prove Rolle's theorem, you need the fact that a continuous function on $[a,b]$ attains both a maximum and a minimum. 
