[proofplan]
We compute the Euler number by representing the Euler class as the pullback of a Thom class along the section $s$. Since $s$ is transverse to the zero section and $\operatorname{rank}E=\dim M$, the zero set is a finite set of transverse intersections. The de Rham representative of the Thom class localizes the integral near those intersections, and in an oriented trivialization the local contribution is the degree of the map representing the section. This degree is exactly the sign of the orientation comparison $\nabla s_p:T_pM\to E_p$, so summing the local contributions gives the formula.
[/proofplan]
custom_env
admin
[step:Represent the Euler number by pulling back a Thom class along the section]Let $z:M\to E$ denote the zero section. Choose a compactly vertically supported Thom class $u_E\in H^n_c(E;\mathbb Z)$ for the oriented rank-$n$ bundle $\pi:E\to M$. We use the standard Thom-class definition of the Euler class:
\begin{align*}
e(E)=z^*u_E\in H^n(M;\mathbb Z).
\end{align*}
Since $s$ and $z$ are homotopic through sections by the smooth homotopy
\begin{align*}
H:M\times[0,1]&\to E
\end{align*}
\begin{align*}
(p,t)&\mapsto t\,s(p),
\end{align*}
homotopy invariance of pullback gives
\begin{align*}
s^*u_E=z^*u_E=e(E)
\end{align*}
in $H^n(M;\mathbb Z)$.
Passing to de Rham cohomology under the coefficient map, choose a closed compactly vertically supported differential form $U_E\in\Omega^n_c(E)$ representing $u_E$. The de Rham pairing with the fundamental class is the integration of the $n$-form $s^*U_E$ over the oriented manifold $M$, so
\begin{align*}
\langle e(E),[M]\rangle=\int_M s^*U_E.
\end{align*}[/step]
custom_env
admin
[guided]The Euler class is designed to measure how the zero section intersects another section. The mechanism is the Thom class. Let $z:M\to E$ be the zero section, and choose a compactly vertically supported Thom class $u_E\in H^n_c(E;\mathbb Z)$ for the oriented vector bundle $E\to M$. By the standard definition of the Euler class via the Thom class,
\begin{align*}
e(E)=z^*u_E.
\end{align*}
We want to replace the zero section $z$ by the given section $s$. This is allowed because all sections of a vector bundle are homotopic through sections to the zero section by fiberwise scalar multiplication. Define
\begin{align*}
H:M\times[0,1]&\to E
\end{align*}
\begin{align*}
(p,t)&\mapsto t\,s(p).
\end{align*}
For each $t\in[0,1]$, the map $p\mapsto t\,s(p)$ is a section of $E\to M$, with $H(\cdot,0)=z$ and $H(\cdot,1)=s$. Homotopy invariance of cohomological pullback gives
\begin{align*}
s^*u_E=z^*u_E=e(E).
\end{align*}
To compute the pairing with $[M]$, pass from integral cohomology to de Rham cohomology. Choose a closed compactly vertically supported differential form $U_E\in\Omega^n_c(E)$ representing the image of $u_E$ in compactly supported de Rham cohomology. Then $s^*U_E$ is a closed $n$-form on the closed oriented $n$-manifold $M$ representing $e(E)$ in de Rham cohomology. By the definition of integration of top-degree forms over an oriented manifold,
\begin{align*}
\langle e(E),[M]\rangle=\int_M s^*U_E.
\end{align*}
This is the point where the topological Euler number becomes an integral that can be localized near the zeros of $s$.[/guided]
custom_env
admin
[step:Use transversality to reduce the zero set to finitely many local contributions]For each $p\in M$, let $0_p:=z(p)\in E_p$ denote the zero vector in the fiber over $p$. The zero set of the section is
\begin{align*}
Z:=Z(s)=\{p\in M:s(p)=0_p\}.
\end{align*}
Because $s$ is transverse to $z(M)\subset E$, the preimage $Z$ is a smooth submanifold of $M$ of dimension
\begin{align*}
\dim M-\operatorname{codim}_E z(M)=n-n=0.
\end{align*}
Thus $Z$ is a discrete subset of $M$. Since $M$ is closed, it is compact, and a discrete closed subset of a compact manifold is finite. Therefore
\begin{align*}
Z=\{p_1,\dots,p_N\}
\end{align*}
for some integer $N\ge 0$.
For each $p_i\in Z$, choose an open neighbourhood $U_i\subset M$ such that the sets $U_1,\dots,U_N$ are pairwise disjoint, each $U_i$ is contained in an oriented coordinate chart on $M$, and $E|_{U_i}$ has an oriented local trivialization. The image $z(M)$ is oriented by the orientation of $M$ through the diffeomorphism $z:M\to z(M)$, and the image $s(M)$ is oriented by the orientation of $M$ through the diffeomorphism $s:M\to s(M)$. At each $p_i$, transversality of $s$ to $z(M)$ means that $s(M)$ and $z(M)$ are transverse oriented $n$-dimensional submanifolds of the oriented $2n$-manifold $E$ meeting at $0_{p_i}$ with complementary dimensions. Since $U_E$ is a compactly vertically supported Thom representative whose fiber orientation is the given orientation of $E$, the de Rham Thom-class local intersection formula applies with this sign convention. Therefore the integral of $s^*U_E$ localizes as the sum of the oriented local intersection contributions of $s(M)$ with $z(M)$ at the points $p_i$:
\begin{align*}
\int_M s^*U_E=\sum_{i=1}^N I_{p_i}(s,z),
\end{align*}
where $I_{p_i}(s,z)$ denotes the local intersection number of the section $s$ with the zero section at $p_i$.[/step]
custom_env
admin
[guided]The role of transversality is to turn the zero set into a finite intersection problem. For each $p\in M$, the symbol $0_p:=z(p)$ denotes the zero vector in the fiber $E_p$, so the zero set is
\begin{align*}
Z=\{p\in M:s(p)=0_p\}.
\end{align*}
Since $s$ is transverse to the zero section submanifold $z(M)\subset E$, the transversality [preimage theorem](/theorems/3903) gives that $Z=s^{-1}(z(M))$ is a smooth submanifold of $M$ of dimension
\begin{align*}
\dim M-\operatorname{codim}_E z(M)=n-n=0.
\end{align*}
A $0$-dimensional submanifold is discrete. The manifold $M$ is closed, hence compact, so a discrete closed subset of $M$ is finite. Thus there are points $p_1,\dots,p_N\in M$, for some integer $N\ge 0$, such that
\begin{align*}
Z=\{p_1,\dots,p_N\}.
\end{align*}
Choose pairwise disjoint open neighbourhoods $U_i\subset M$ of the points $p_i$ such that each $U_i$ lies in an oriented coordinate chart on $M$ and such that $E|_{U_i}$ admits an oriented local trivialization. The image $z(M)$ is oriented using the diffeomorphism $z:M\to z(M)$, and the image $s(M)$ is oriented using the diffeomorphism $s:M\to s(M)$. At $p_i$, transversality of $s$ to $z(M)$ says exactly that these two oriented $n$-dimensional submanifolds of the oriented total space $E$ meet transversely and with complementary dimensions at $0_{p_i}$. The compact vertical support of $U_E$ ensures that the Thom representative measures intersection with the zero section, and the chosen fiber orientation is the orientation used in the Thom class. Therefore the de Rham Thom-class local intersection formula applies with the sign convention determined by the orientations of $M$, $E$, and the fibers of $E$. It gives
\begin{align*}
\int_M s^*U_E=\sum_{i=1}^N I_{p_i}(s,z),
\end{align*}
where $I_{p_i}(s,z)$ is the oriented local intersection number of $s(M)$ and $z(M)$ at the point $0_{p_i}\in E$.[/guided]
custom_env
admin
[step:Identify each local intersection number with the sign of the vertical derivative]Fix a zero $p\in Z$. Choose an oriented coordinate chart $(U,\varphi)$ around $p$ with $\varphi(p)=0\in\mathbb R^n$, and choose an oriented local trivialization
\begin{align*}
\Phi:E|_U&\to U\times\mathbb R^n
\end{align*}
of $E|_U$. In this trivialization, the section $s|_U$ has the form
\begin{align*}
s|_U:U&\to E|_U
\end{align*}
\begin{align*}
x&\mapsto \Phi^{-1}(x,f(x)),
\end{align*}
for a smooth map
\begin{align*}
f:U&\to\mathbb R^n.
\end{align*}
The zero condition $s(p)=0_p$ is equivalent to $f(p)=0$.
The vertical derivative of $s$ at $p$ is represented in these oriented coordinates and trivialization by
\begin{align*}
df_p:T_pM\to\mathbb R^n.
\end{align*}
Transversality of $s$ to the zero section is precisely the statement that this [linear map](/page/Linear%20Map) is an isomorphism. Hence the local intersection number is the local degree of $f$ at the regular zero $p$:
\begin{align*}
I_p(s,z)=\deg_p(f,0).
\end{align*}
Let $Jf_p\in\mathbb R^{n\times n}$ denote the [Jacobian matrix](/page/Jacobian%20Matrix) representing $df_p$ in the chosen oriented coordinate basis of $T_pM$ and the chosen oriented fiber basis of $E_p\cong\mathbb R^n$. Define $\operatorname{sgn}(a)=+1$ for $a>0$ and $\operatorname{sgn}(a)=-1$ for $a<0$. Since $df_p$ is an isomorphism, $\det Jf_p\ne 0$. For a regular zero, the local degree is the sign of the determinant of this Jacobian matrix in oriented coordinates:
\begin{align*}
\deg_p(f,0)=\operatorname{sgn}\det Jf_p.
\end{align*}
By the definition of the local index,
\begin{align*}
\operatorname{ind}_p(s)=\operatorname{sgn}\det Jf_p.
\end{align*}
Therefore
\begin{align*}
I_p(s,z)=\operatorname{ind}_p(s).
\end{align*}[/step]
custom_env
admin
[guided]We now identify the sign coming from local intersection theory with the sign used in the definition of the local index. Fix $p\in Z$. Choose an oriented coordinate chart $(U,\varphi)$ around $p$ with $\varphi(p)=0\in\mathbb R^n$, and choose an oriented local trivialization
\begin{align*}
\Phi:E|_U\to U\times\mathbb R^n
\end{align*}
of $E|_U$. In this trivialization the section $s|_U$ is represented by a smooth map
\begin{align*}
f:U\to\mathbb R^n
\end{align*}
through the formula $s(x)=\Phi^{-1}(x,f(x))$ for $x\in U$. The equation $s(p)=0_p$ is therefore equivalent to $f(p)=0$.
The vertical derivative $\nabla s_p:T_pM\to E_p$ is represented, after the chosen oriented coordinate basis on $T_pM$ and the chosen oriented fiber basis of $E_p\cong\mathbb R^n$, by the derivative
\begin{align*}
df_p:T_pM\to\mathbb R^n.
\end{align*}
Transversality to the zero section says that this linear map is an isomorphism. Let $Jf_p\in\mathbb R^{n\times n}$ be the Jacobian matrix of $df_p$ in these two oriented bases. Since $df_p$ is an isomorphism, $\det Jf_p\ne 0$. Define $\operatorname{sgn}(a)=+1$ for $a>0$ and $\operatorname{sgn}(a)=-1$ for $a<0$. The local degree formula for a regular zero gives
\begin{align*}
\deg_p(f,0)=\operatorname{sgn}\det Jf_p.
\end{align*}
The de Rham local intersection number $I_p(s,z)$ is this local degree, because in the chosen oriented trivialization the zero section is $U\times\{0\}$ and the graph of $s$ is the graph of $f$. Hence
\begin{align*}
I_p(s,z)=\deg_p(f,0)=\operatorname{sgn}\det Jf_p.
\end{align*}
By the definition of $\operatorname{ind}_p(s)$ in the theorem statement, the same sign records whether the vertical derivative $\nabla s_p:T_pM\to E_p$ preserves or reverses orientation. Therefore
\begin{align*}
I_p(s,z)=\operatorname{ind}_p(s).
\end{align*}[/guided]
custom_env
admin
[step:Sum the local indices to obtain the Euler number]Combining the Thom-class integral formula with the local intersection computation gives
\begin{align*}
\langle e(E),[M]\rangle
=
\int_M s^*U_E.
\end{align*}
The integral is the sum of the local intersection numbers:
\begin{align*}
\int_M s^*U_E
=
\sum_{p\in Z} I_p(s,z).
\end{align*}
For every $p\in Z$, the previous step gives
\begin{align*}
I_p(s,z)=\operatorname{ind}_p(s).
\end{align*}
Since $Z=Z(s)=\{p\in M:s(p)=0_p\}$ is finite, we conclude
\begin{align*}
\langle e(E),[M]\rangle
=
\sum_{p\in Z(s)}\operatorname{ind}_p(s).
\end{align*}
This is the desired zero-counting formula for the Euler class.[/step]
custom_env
admin
[guided]The final step only assembles the identities already proved. First, the Thom-class computation gave
\begin{align*}
\langle e(E),[M]\rangle=\int_M s^*U_E.
\end{align*}
Second, localization of the Thom representative at the transverse zeros gave
\begin{align*}
\int_M s^*U_E=\sum_{p\in Z}I_p(s,z).
\end{align*}
Third, the local coordinate computation showed that, for every $p\in Z$,
\begin{align*}
I_p(s,z)=\operatorname{ind}_p(s).
\end{align*}
Substituting the third identity into the second and then using the first gives
\begin{align*}
\langle e(E),[M]\rangle=\sum_{p\in Z}\operatorname{ind}_p(s).
\end{align*}
Finally $Z=Z(s)=\{p\in M:s(p)=0_p\}$ by definition, so this is exactly
\begin{align*}
\langle e(E),[M]\rangle=\sum_{p\in Z(s)}\operatorname{ind}_p(s).
\end{align*}[/guided]