Let $(M,g)$ be a $d$-dimensional Riemannian manifold, $T^*M$ is the cotangent bundle. and the local chart is $$ T^*M|_{U}=U\times R^d=(x^1,...,x^d,p_1,...,p_d) $$ Define $$ H(x,p):=g^{ij}(x)p_ip_j $$ and for some given $\lambda>0$ $$ E_\lambda:=\{(x,p)\in T^*M:H(x,p)=\lambda\} $$
Then, why $M$ is compact ,so is $E_\lambda$ ?
I think it is because that :
Fix $x$, because $H(x,p)$ is continuous , then $E_\lambda$ is compact in $R^d$.
And $M$ is compact ,then $E_\lambda$ is equal to the product of two compact sets. So, it still be a compact set . In fact, the product is not suitable, because it is placed a compact space in every points of $M$.So, how to precisely explain it ?