[step:Identify the local index sum with the Euler number]Let $E:=TM$ be the oriented rank-$n$ tangent bundle over $M$, let $\pi:E\to M$ be its bundle projection, and let $0_E:M\to E$ be the zero section. Let $\tau\in H^n(E,E\setminus 0_E(M);\mathbb{Z})$ denote the [Thom class](/page/Thom%20Class) compatible with the orientation of $E$. The [Euler class](/page/Euler%20Class) is
\begin{align*}
e(E):=0_E^*\tau\in H^n(M;\mathbb{Z}).
\end{align*}
Let $[M]\in H_n(M;\mathbb{Z})$ denote the fundamental class determined by the given orientation of $M$. Put $Z:=Z(X)$. Since $X$ is nonzero on $M\setminus Z$, the section $X$ is a map of pairs
\begin{align*}
X_Z:(M,M\setminus Z)&\to (E,E\setminus 0_E(M)).
\end{align*}
The pullback $X_Z^*\tau\in H^n(M,M\setminus Z;\mathbb{Z})$ maps to $e(E)$ under the natural map to $H^n(M;\mathbb{Z})$. Indeed, after forgetting the relative condition, $X$ and $0_E$ are homotopic through the fibrewise linear homotopy $(t,q)\mapsto tX(q)$, so [homotopy invariance of cohomology](/page/Homotopy%20Invariance%20of%20Cohomology) makes their ordinary pullbacks of the Thom class agree.
Let
\begin{align*}
[M,M\setminus Z]\in H_n(M,M\setminus Z;\mathbb{Z})
\end{align*}
be the relative fundamental class obtained from the oriented fundamental class $[M]$ under the natural map $H_n(M;\mathbb{Z})\to H_n(M,M\setminus Z;\mathbb{Z})$.
Choose pairwise disjoint closed oriented coordinate balls $B_p\subset M$, one around each $p\in Z(X)$, containing no other zero, and put $N:=\bigcup_{p\in Z(X)}B_p$. Since $X$ is nonzero on $M\setminus N$, [excision](/page/Excision) gives an isomorphism
\begin{align*}
H^n(M,M\setminus Z;\mathbb{Z}) \cong H^n(N,N\setminus Z;\mathbb{Z}).
\end{align*}
Under this isomorphism, additivity of relative fundamental classes identifies $[M,M\setminus Z]$ with the sum of the classes $[B_p,B_p\setminus\{p\}]$. The punctured ball $B_p\setminus\{p\}$ [deformation retracts](/page/Deformation%20Retract) onto $\partial B_p$, so homotopy invariance for pairs allows the pairing to be computed on $(B_p,\partial B_p)$. Therefore
\begin{align*}
\langle e(TM),[M]\rangle
&=\langle X_Z^*\tau,[M,M\setminus Z]\rangle\\
&=\sum_{p\in Z(X)}\langle X_Z^*\tau,[B_p,\partial B_p]\rangle.
\end{align*}
Under the oriented trivialisation of $TM$ over $B_p$ induced by the chosen chart, the Thom class restricts, by the local form of the [Thom isomorphism](/page/Thom%20Isomorphism), to the standard generator of $H^n(\mathbb{R}^n,\mathbb{R}^n\setminus\{0\};\mathbb{Z})$. The [relative degree](/page/Relative%20Degree) interpretation of this generator identifies
\begin{align*}
\langle X_Z^*\tau,[B_p,\partial B_p]\rangle=\deg(\nu_p)=\operatorname{ind}_p(X).
\end{align*}
Therefore
\begin{align*}
I(X)=\sum_{p\in Z(X)}\operatorname{ind}_p(X)=\langle e(TM),[M]\rangle.
\end{align*}
Apply the same identity to the Morse model vector field $V$ constructed above. The previous step gives $I(V)=\chi(M)$, hence
\begin{align*}
\langle e(TM),[M]\rangle=I(V)=\chi(M).
\end{align*}
Combining the two displayed identities gives
\begin{align*}
\sum_{p\in Z(X)}\operatorname{ind}_p(X)=I(X)=\langle e(TM),[M]\rangle=\chi(M),
\end{align*}
which is the desired identity.[/step]