In this paper we study ergodic theory of countable Markov shifts. These are dynamical systems defined over non-compact spaces. Our main result relates the escape of mass, the measure theoretic entropy, and the entropy at infinity of the system. This relation has several consequences. For example we obtain that the entropy map is upper semi-continuous and that the ergodic measures form an entropy dense subset. Our results also provide new proofs of results describing the existence and stability of the measure of maximal entropy. We relate the entropy at infinity with the Hausdorff dimension of the set of recurrent points that escape on average. Of independent interest, we prove a version of Katok’s entropy formula in this non-compact setting