[proofplan]
We prove the statement from the universal definition of Chern classes, where $BU(r)$ denotes the classifying space for rank-$r$ complex vector bundles and carries the universal rank-$r$ complex vector bundle. Choose a classifying map $g:M\to BU(r)$ for $E$, so that $c_k(E)$ is the pullback of the universal Chern class $c_k^{\mathrm{univ}}\in H^{2k}(BU(r);\mathbb Z)$. The pullback bundle $f^*E\to N$ is classified by the composite $g\circ f:N\to BU(r)$, and functoriality of singular cohomology pullback gives the desired identity. The cases $k=0$ and $k>r$ follow from preservation of the cohomological unit and the rank convention.
[/proofplan]
[step:Choose a classifying map and recall the universal definition of Chern classes]
Let $r\in\mathbb N$ denote the complex rank of $E$. Let $BU(r)$ denote the classifying space for rank-$r$ complex vector bundles, equipped with its universal rank-$r$ complex vector bundle. Since smooth manifolds are paracompact under the standard convention, the classifying-space theorem for complex vector bundles applies to $E\to M$. Therefore there exists a continuous map
\begin{align*}
g:M\to BU(r)
\end{align*}
such that $E$ is isomorphic, as a complex vector bundle over $M$, to the pullback of the universal rank-$r$ complex vector bundle over $BU(r)$ along $g$.
For each integer $k$ with $0\le k\le r$, let
\begin{align*}
c_k^{\mathrm{univ}}\in H^{2k}(BU(r);\mathbb Z)
\end{align*}
denote the $k$-th universal Chern class. By definition of Chern classes through the universal bundle,
\begin{align*}
c_k(E)=g^*c_k^{\mathrm{univ}}\in H^{2k}(M;\mathbb Z).
\end{align*}
For $k>r$, the standard convention gives $c_k(E)=0$.
[guided]
The point of introducing $BU(r)$ is that Chern classes are defined universally. Here $BU(r)$ denotes the classifying space for rank-$r$ complex vector bundles, equipped with its universal rank-$r$ complex vector bundle. Since $E\to M$ has rank $r$ and smooth manifolds are paracompact under the standard convention, the classifying-space theorem applies and gives a continuous map
\begin{align*}
g:M\to BU(r)
\end{align*}
with the property that $E$ is isomorphic to the pullback along $g$ of the universal rank-$r$ complex vector bundle.
The universal space $BU(r)$ carries canonical classes
\begin{align*}
c_k^{\mathrm{univ}}\in H^{2k}(BU(r);\mathbb Z)
\end{align*}
for $0\le k\le r$. The definition of the Chern class of $E$ is then
\begin{align*}
c_k(E)=g^*c_k^{\mathrm{univ}}.
\end{align*}
This identity lives in $H^{2k}(M;\mathbb Z)$ because cohomology pullback along $g$ maps $H^{2k}(BU(r);\mathbb Z)$ to $H^{2k}(M;\mathbb Z)$. For $k>r$, the usual rank convention says that $c_k(E)=0$, so the only substantive range is $0\le k\le r$.
[/guided]
[/step]
[step:Identify the classifying map of the pulled-back bundle]
The pullback vector bundle $f^*E\to N$ is classified by the composite map
\begin{align*}
g\circ f:N\to BU(r).
\end{align*}
Indeed, since $E$ is classified by $g$, pulling the universal bundle first along $g$ and then along $f$ is naturally isomorphic to pulling it back along $g\circ f$. Hence, for every integer $k$ with $0\le k\le r$,
\begin{align*}
c_k(f^*E)=(g\circ f)^*c_k^{\mathrm{univ}}\in H^{2k}(N;\mathbb Z).
\end{align*}
[/step]
[step:Apply functoriality of cohomology pullback]
Singular cohomology pullback is contravariantly functorial: for continuous maps $f:N\to M$ and $g:M\to BU(r)$,
\begin{align*}
(g\circ f)^*=f^*\circ g^*
\end{align*}
as maps from $H^{2k}(BU(r);\mathbb Z)$ to $H^{2k}(N;\mathbb Z)$. Therefore, for $0\le k\le r$,
\begin{align*}
c_k(f^*E)=(g\circ f)^*c_k^{\mathrm{univ}}.
\end{align*}
Using functoriality,
\begin{align*}
c_k(f^*E)=f^*\bigl(g^*c_k^{\mathrm{univ}}\bigr).
\end{align*}
Using the universal definition of $c_k(E)$,
\begin{align*}
c_k(f^*E)=f^*c_k(E).
\end{align*}
[guided]
We now use the basic functoriality property of singular cohomology: if
\begin{align*}
f:N\to M
\end{align*}
and
\begin{align*}
g:M\to BU(r)
\end{align*}
are continuous maps, then pulling back a cohomology class along the composite $g\circ f$ is the same as first pulling it back along $g$ and then along $f$. In symbols,
\begin{align*}
(g\circ f)^*=f^*\circ g^*.
\end{align*}
This is the only formal property of cohomology needed here.
Apply this identity to the universal Chern class
\begin{align*}
c_k^{\mathrm{univ}}\in H^{2k}(BU(r);\mathbb Z).
\end{align*}
Because $f^*E$ is classified by $g\circ f$, its $k$-th Chern class is
\begin{align*}
c_k(f^*E)=(g\circ f)^*c_k^{\mathrm{univ}}.
\end{align*}
Functoriality changes the right-hand side to
\begin{align*}
(g\circ f)^*c_k^{\mathrm{univ}}=f^*\bigl(g^*c_k^{\mathrm{univ}}\bigr).
\end{align*}
Finally, the class $g^*c_k^{\mathrm{univ}}$ is exactly $c_k(E)$ by the universal definition of Chern classes. Hence
\begin{align*}
c_k(f^*E)=f^*c_k(E).
\end{align*}
[/guided]
[/step]
[step:Check the unit class and the rank convention]
For $k=0$, the class $c_0(E)$ is the unit $1\in H^0(M;\mathbb Z)$, and cohomology pullback preserves units. Hence
\begin{align*}
c_0(f^*E)=1=f^*1=f^*c_0(E).
\end{align*}
For $k>r$, both $E$ and $f^*E$ have complex rank $r$, so the rank convention gives
\begin{align*}
c_k(E)=0
\end{align*}
and
\begin{align*}
c_k(f^*E)=0.
\end{align*}
Since $f^*0=0$, the same identity holds for $k>r$. Combining this with the calculation for $1\le k\le r$ proves the theorem for every integer $k\ge 0$.
[guided]
There are two endpoint ranges that are not covered by the calculation with the universal classes in positive degree. First take $k=0$. By convention, the zeroth Chern class of any complex vector bundle is the cohomological unit, so
\begin{align*}
c_0(E)=1\in H^0(M;\mathbb Z)
\end{align*}
and
\begin{align*}
c_0(f^*E)=1\in H^0(N;\mathbb Z).
\end{align*}
The pullback homomorphism in singular cohomology preserves the cup-product unit, hence $f^*1=1$. Therefore
\begin{align*}
c_0(f^*E)=1=f^*1=f^*c_0(E).
\end{align*}
Now take an integer $k>r$. The original bundle $E\to M$ has complex rank $r$, and the pullback bundle $f^*E\to N$ also has complex rank $r$ because each fibre of $f^*E$ over $y\in N$ is the fibre $E_{f(y)}$. The rank convention for Chern classes therefore gives
\begin{align*}
c_k(E)=0
\end{align*}
and
\begin{align*}
c_k(f^*E)=0.
\end{align*}
Since the cohomology pullback $f^*:H^{2k}(M;\mathbb Z)\to H^{2k}(N;\mathbb Z)$ is a [group homomorphism](/page/Group%20Homomorphism), it sends the zero class to the zero class. Hence
\begin{align*}
c_k(f^*E)=0=f^*0=f^*c_k(E).
\end{align*}
Together with the already proved range $1\le k\le r$, this proves the naturality identity for every integer $k\ge 0$.
[/guided]
[/step]