[guided]We prove the asymptotic variance identity from first principles in the finite-state setting. The advantage of working on $L^2_0(\pi)$ is that the constant eigenfunction has been removed, so the problematic eigenvalue $1$ no longer appears.
Because $P$ is reversible with respect to $\pi$, the operator $P:L^2_0(\pi)\to L^2_0(\pi)$ is self-adjoint. Since $L^2_0(\pi)$ is finite-dimensional, the finite-dimensional spectral theorem for self-adjoint operators gives an [orthonormal basis](/page/Orthonormal%20Basis) $(e_j)_{j=1}^m$ of $L^2_0(\pi)$ and [real numbers](/page/Real%20Numbers) $\lambda_1,\dots,\lambda_m$ such that $Pe_j=\lambda_j e_j$ for each $j$.
We now verify the spectral restrictions used below. If $Pf=\lambda f$ on $L^2(\pi)$ and $x_0 \in E$ is chosen so that $|f(x_0)|=\max_{x \in E}|f(x)|$, then
\begin{align*}
|\lambda| |f(x_0)| = |(Pf)(x_0)| \le \sum_{y \in E}P(x_0,y)|f(y)| \le |f(x_0)|.
\end{align*}
For a nonzero eigenfunction this gives $|\lambda|\le 1$. If $\lambda=1$, equality in the maximum principle and irreducibility force $f$ to be constant on all states reachable from $x_0$, hence on all of $E$; therefore the only eigenfunctions with eigenvalue $1$ are constants, and no nonzero constant lies in $L^2_0(\pi)$. If $\lambda=-1$, equality forces every transition with positive probability to move between opposite signs of an extremal eigenfunction, producing a two-class cyclic decomposition of the irreducible chain. That contradicts aperiodicity. Hence each eigenvalue on $L^2_0(\pi)$ satisfies
\begin{align*}
-1 < \lambda_j < 1.
\end{align*}
Now expand the centered observable:
\begin{align*}
g = \sum_{j=1}^m a_j e_j,
\end{align*}
where $a_j:=\langle g,e_j\rangle_\pi$. Let $\mathbb{P}$ denote the law of the stationary Markov chain with transition kernel $P$ and initial law $\pi$, and let $\mathbb{E}$ denote expectation with respect to $\mathbb{P}$. For square-integrable real random variables $Y,Z:\Omega \to \mathbb{R}$, define
\begin{align*}
\operatorname{Cov}(Y,Z) := \mathbb{E}[(Y-\mathbb{E}[Y])(Z-\mathbb{E}[Z])].
\end{align*}
Since the chain is stationary, $X_0$ has law $\pi$, and the Markov property gives
\begin{align*}
\mathbb{E}[g(X_k)\mid X_0] = (P^k g)(X_0).
\end{align*}
Because $\pi(g)=0$, the covariance at lag $k$ is
\begin{align*}
\operatorname{Cov}(g(X_0),g(X_k)) = \mathbb{E}[g(X_0)g(X_k)] = \langle g,P^k g\rangle_\pi.
\end{align*}
The variance of the empirical average is therefore the sum of all lag covariances:
\begin{align*}
N\operatorname{Var}\left(\frac{1}{N}\sum_{n=0}^{N-1}g(X_n)\right) = \sum_{k=-(N-1)}^{N-1}\left(1-\frac{|k|}{N}\right)\langle g,P^{|k|}g\rangle_\pi.
\end{align*}
The eigenbasis diagonalizes each covariance term:
\begin{align*}
\langle g,P^k g\rangle_\pi = \sum_{j=1}^m a_j^2\lambda_j^k.
\end{align*}
For a fixed eigenvalue $\lambda_j$ with $|\lambda_j|<1$, the weighted covariance sum converges to the two-sided geometric series
\begin{align*}
1 + 2\sum_{k=1}^{\infty}\lambda_j^k = \frac{1+\lambda_j}{1-\lambda_j}.
\end{align*}
There are only finitely many eigenvalues, so we may pass the limit through the finite sum and obtain
\begin{align*}
\sigma_P^2(g) = \sum_{j=1}^m a_j^2\frac{1+\lambda_j}{1-\lambda_j}.
\end{align*}
Finally, because $(I-P)e_j=(1-\lambda_j)e_j$ and $1-\lambda_j>0$, the inverse $(I-P)^{-1}$ is well-defined on $L^2_0(\pi)$, and
\begin{align*}
(I+P)(I-P)^{-1}e_j = \frac{1+\lambda_j}{1-\lambda_j}e_j.
\end{align*}
Thus the preceding spectral expression is exactly
\begin{align*}
\sigma_P^2(g)=\langle g,(I+P)(I-P)^{-1}g\rangle_\pi.
\end{align*}[/guided]