[proofplan]
We pass from de Rham cohomology to singular cohomology with real coefficients using the [de Rham theorem](/theorems/3596). The top real singular cohomology is then computed from top real singular homology by the universal coefficient theorem over the field $\mathbb{R}$. The remaining input is the standard top-homology characterization of orientability for connected closed manifolds: the top real homology is $\mathbb{R}$ in the orientable case and $0$ in the non-orientable case.
[/proofplan]
[step:Identify de Rham cohomology with real singular cohomology]
Let $H^n(M;\mathbb{R})$ denote the degree-$n$ singular cohomology group of the topological space underlying $M$ with coefficients in the real [vector space](/page/Vector%20Space) $\mathbb{R}$. By the de Rham theorem (citing a result not yet in the wiki: de Rham Theorem), there is a natural real-vector-space isomorphism
\begin{align*}
\Phi^n_M: H^n_{dR}(M) \longrightarrow H^n(M;\mathbb{R}).
\end{align*}
Therefore it suffices to compute $H^n(M;\mathbb{R})$.
[guided]
The first step replaces the analytic object $H^n_{dR}(M)$ by a topological object. Let $H^n(M;\mathbb{R})$ be singular cohomology with coefficients in $\mathbb{R}$. The de Rham theorem (citing a result not yet in the wiki: de Rham Theorem) gives, for every smooth manifold $M$, a natural real-vector-space isomorphism
\begin{align*}
\Phi^n_M: H^n_{dR}(M) \longrightarrow H^n(M;\mathbb{R}).
\end{align*}
The theorem applies because $M$ is a smooth manifold. Since $\Phi^n_M$ is an isomorphism, $H^n_{dR}(M)$ is isomorphic to $\mathbb{R}$ exactly when $H^n(M;\mathbb{R})$ is isomorphic to $\mathbb{R}$, and $H^n_{dR}(M)$ is zero exactly when $H^n(M;\mathbb{R})$ is zero. Thus the problem is reduced to computing the top singular cohomology group with real coefficients.
[/guided]
[/step]
[step:Convert top cohomology into the dual of top homology]
Let $H_n(M;\mathbb{R})$ denote the degree-$n$ singular homology group of $M$ with coefficients in $\mathbb{R}$. Since $\mathbb{R}$ is a field, the universal coefficient theorem for cohomology over a field (citing a result not yet in the wiki: Universal Coefficient Theorem for Cohomology) gives a natural real-vector-space isomorphism
\begin{align*}
\Psi^n_M: H^n(M;\mathbb{R}) \longrightarrow \operatorname{Hom}_{\mathbb{R}}(H_n(M;\mathbb{R}),\mathbb{R}).
\end{align*}
Thus $H^n(M;\mathbb{R})$ is the real dual of $H_n(M;\mathbb{R})$.
[guided]
Now we translate cohomology into homology. Let $H_n(M;\mathbb{R})$ be the degree-$n$ singular homology group with real coefficients. The universal coefficient theorem for cohomology over a field (citing a result not yet in the wiki: Universal Coefficient Theorem for Cohomology) states that, for a space $X$ and a field $k$, there is a natural isomorphism
\begin{align*}
H^n(X;k) \cong \operatorname{Hom}_k(H_n(X;k),k).
\end{align*}
We apply this with $X=M$ and $k=\mathbb{R}$. The coefficient ring is a field, so there is no extension term to account for. Hence we obtain a natural real-vector-space isomorphism
\begin{align*}
\Psi^n_M: H^n(M;\mathbb{R}) \longrightarrow \operatorname{Hom}_{\mathbb{R}}(H_n(M;\mathbb{R}),\mathbb{R}).
\end{align*}
Therefore the computation of $H^n(M;\mathbb{R})$ is reduced to the computation of the top real homology group $H_n(M;\mathbb{R})$.
[/guided]
[/step]
[step:Compute top real homology from orientability]
By the top-dimensional homology characterization of orientability for connected closed manifolds (citing a result not yet in the wiki: Top Homology and Orientability of Closed Manifolds), the connected closed $n$-manifold $M$ satisfies
\begin{align*}
H_n(M;\mathbb{R}) \cong \mathbb{R}
\end{align*}
if $M$ is orientable, and
\begin{align*}
H_n(M;\mathbb{R}) = 0
\end{align*}
if $M$ is non-orientable.
[guided]
This is the topological input where orientability enters. The top-dimensional homology characterization of orientability for connected closed manifolds (citing a result not yet in the wiki: Top Homology and Orientability of Closed Manifolds) says precisely that a connected closed $n$-manifold has a real top-dimensional fundamental class exactly in the orientable case. Because $M$ is connected and closed by hypothesis, the theorem applies to $M$ and gives
\begin{align*}
H_n(M;\mathbb{R}) \cong \mathbb{R}
\end{align*}
when $M$ is orientable. In the non-orientable case, no globally consistent real fundamental class exists, and the same theorem gives
\begin{align*}
H_n(M;\mathbb{R}) = 0.
\end{align*}
Thus orientability completely determines the top real homology group.
[/guided]
[/step]
[step:Take real duals and transfer the result back to de Rham cohomology]
If $M$ is orientable, then
\begin{align*}
H^n(M;\mathbb{R})
&\cong \operatorname{Hom}_{\mathbb{R}}(H_n(M;\mathbb{R}),\mathbb{R}) \\
&\cong \operatorname{Hom}_{\mathbb{R}}(\mathbb{R},\mathbb{R}) \\
&\cong \mathbb{R}.
\end{align*}
Composing this isomorphism with the de Rham isomorphism from the first step gives
\begin{align*}
H^n_{dR}(M) \cong \mathbb{R}.
\end{align*}
If $M$ is non-orientable, then
\begin{align*}
H^n(M;\mathbb{R})
&\cong \operatorname{Hom}_{\mathbb{R}}(H_n(M;\mathbb{R}),\mathbb{R}) \\
&\cong \operatorname{Hom}_{\mathbb{R}}(0,\mathbb{R}) \\
&= 0.
\end{align*}
Again using the de Rham isomorphism, this gives
\begin{align*}
H^n_{dR}(M) = 0.
\end{align*}
This proves both asserted cases.
[/step]