Top cohomology detecting compactness I am looking for a reference for the fact that the top cohomology $H^n(X;A)$ of an $n$-dimensional manifold $X$ is non-trivial precisely when $X$ is compact.
I tried to ask this question on Math.Stackexchange, but there was some issue regarding orientability.
If $X$ is orientable, this should follow from standard Poincaré duality, but in my understanding the assumption of orientability can be removed by using "twisted" Poincaré duality. In this case, the coefficients must be local for $H^n$ to be non-trivial. (Edit: They don't need to be local, see the answer by Johannes Ebert below.) But if the coefficients respect the orientation (i.e. the coefficients are a constant sheaf, which is twisted by the orientation character), then $H^n\neq0$ if and only if $X$ is compact.
I vaguely remember hearing about an isomorphism $H^n\cong H_c^0$, where $H_c^\ast$ denotes compactly supported cohomology. The argument then goes that $H_c^0$ is non-trivial precisely when $X$ is non-compact, which I think of by using covers in Čech cohomology. $0$th cohomology with values in the sheaf of locally constant functions is just constant functions on all open sets of the cover $\{U_i\}$ and these functions must agree on single intersections $U_i\cap U_j$. The cohomology classes are thus given by globally constant functions, which, for compactly supported cohomology can only be the zero function when $X$ is non-compact, and can be any constant function when $X$ is compact.
It seems this argument makes no use of orientability, provided, there exists a twisted version of $H^n\cong H_c^0$...
 A: For algebraic varieties, there is an analogue in terms of cohomology of coherent sheaves. It reads as follows: if $X$ is an irreducible quasi-projective algebraic variety over a field $k$, of dimension $n$, then $X$ is projective if and only if $H^n(X,F)\ne 0$ for some coherent sheaf $F$ on $X$. This was conjectured by Lichtenbaum, a first proof was given by Grothendieck (see thm 6.9 in Hartshorne, Local cohomology, Springer LNM), another one by Kleiman (On the Vanishing of $H^n(X,F)$ for an $n$-dimensional variety, Proc. AMS 1967).
A: A connected $n$-manifold $M \neq \emptyset$ is compact iff $H^n (M;\mathbb{Z}) \neq 0$.
EDIT: my old reference to Bredon, Topology and Geometry, page 346 ff, does not completely settle the issue, as George pointed out. So let me give a proof here. For compact $M$, Corollary 7.14 of the cited book gives the answer.
If $M$ is not compact, then Corollary 7.12 shows that $H_n (M;\mathbb{Z})=0$. By Corollary 7.13, $H_{n-1}(M;\mathbb{Z})$ is torsionfree. That is not by itself enough to conclude that $H^n (M,\mathbb{Z})=0$, since for example it could potentially happen that $H_{n-1}(M;\mathbb{Z})=\mathbb{Q}$, leading to a horrendous Ext-term. But such pathologies do not happen.
By Poincare duality,
$$H^n(M;\mathbb{Z}) \cong H_0^{lf}(M;\mathbb{Z}_w)$$
(locally finite homology twisted by the orientation character). Any class in $H_0^{lf}(M;\mathbb{Z}_w)$ is represented by a locally finite collection of points, each labelled with an element of the fibre of $\mathbb{Z}_w$.
In other words, for every class $x \in H_0^{lf}(M;\mathbb{Z}_w)$, there is an at most countable discrete space $S$, a proper map $f:S \to M$ and $y \in H_0^{lf} (S,f^{\ast} \mathbb{Z}_w)= H_0^{lf}(S,\mathbb{Z})$ such that $f_\ast (y)=x$.
To show that $x=0$, I show that each proper map $f: S \to M$ can be extended to a proper map $h: S \times [0,\infty) \to M$. This settles the claim as $H_0^{lf}(S \times [0,\infty))=0$.
For each point $s \in S$, there is an 'exit path', i.e. a proper map $q_s: [0, \infty) \to M$, $q(0)=f(s)$. I wish to choose $h:S \times [0,\infty) \to M$ as the disjoint union of all the $q_s$'s, but without further care, $h$ can fail to be proper. We have to arrange the exit paths in such a way that each compact region $K \subset M$ is only hit by finitely many $q_s$'s.
To overcome this problem, write $M= \bigcup_{n\geq 0} N_n$ as the ascending union of compact codimension $0$ submanifolds with boundary. After replacing $N_n$ with $M_n$, the union of $N_n$ with all relatively compact connected components of $M-N_n$, the following is true: $M= \bigcup_{n \geq 0} M_n$, $M-M_n$ has no relatively compact connected component. The construction of the exhaustion guarantees that if $f(s) \in M_n-M_{n-1}$, $q_s$ can be chosen to stay in $M-M_{n-1}$. Hence the required finiteness is guaranteed.
