[proofplan]
We construct $A_f$ as the quotient of $J_0(N)$ cut out by the Hecke eigensystem of the normalised newform $f$. The Hecke algebra action gives $A_f$ an action of the coefficient field $K_f$, and the standard newform quotient theorem computes the resulting $\lambda$-adic Tate component as a two-dimensional [vector space](/page/Vector%20Space) over $K_{f,\lambda}$. Finally, for primes $p \nmid N\ell$, good reduction and the Eichler-Shimura relation identify the Frobenius characteristic polynomial with the Hecke polynomial $1-a_p(f)X+pX^2$.
[/proofplan]
[step:Cut out the newform quotient of $J_0(N)$ by the Hecke eigensystem]
Let $\mathbb T \subset \operatorname{End}_{\mathbb Q}(J_0(N))$ denote the commutative Hecke algebra generated by the Hecke operators $T_n$ for $n \ge 1$ acting on the Jacobian $J_0(N)$ of the modular curve $X_0(N)$. Since $f \in S_2(\Gamma_0(N))$ is a normalised newform, its Fourier coefficients define a homomorphism of $\mathbb Q$-algebras
\begin{align*}
\theta_f: \mathbb T \otimes_{\mathbb Z} \mathbb Q &\to K_f \\
T_n &\mapsto a_n(f).
\end{align*}
Let $I_f := \ker(\theta_f) \cap \mathbb T$ be the integral annihilator ideal of the eigensystem of $f$. Since $\mathbb T$ is a finite $\mathbb Z$-module, choose generators $u_1,\dots,u_r \in I_f$ as a $\mathbb Z$-module. Define $I_fJ_0(N)$ to be the connected abelian subvariety
\begin{align*}
I_fJ_0(N) := u_1(J_0(N)) + \cdots + u_r(J_0(N)) \subset J_0(N),
\end{align*}
which is independent of the chosen finite generating set because it is the abelian subvariety generated by all images $u(J_0(N))$ with $u \in I_f$. Define
\begin{align*}
A_f := J_0(N) / I_f J_0(N).
\end{align*}
By the newform quotient construction for $J_0(N)$, applied to the normalised newform $f$ of level $\Gamma_0(N)$, this quotient is an abelian variety over $\mathbb Q$, the quotient map $J_0(N) \to A_f$ is defined over $\mathbb Q$, and the rational Hecke algebra acting faithfully on $A_f$ identifies with the simple factor $K_f$ cut out by $\theta_f$.
[guided]
The first task is to turn the eigenform $f$ into geometry. The Hecke operators on $J_0(N)$ form a commutative algebra
\begin{align*}
\mathbb T \subset \operatorname{End}_{\mathbb Q}(J_0(N)),
\end{align*}
and the normalisation of $f$ supplies the eigenvalue rule $T_n \mapsto a_n(f)$. This gives the $\mathbb Q$-algebra homomorphism
\begin{align*}
\theta_f: \mathbb T \otimes_{\mathbb Z} \mathbb Q &\to K_f \\
T_n &\mapsto a_n(f).
\end{align*}
The ideal $I_f := \ker(\theta_f) \cap \mathbb T$ consists precisely of the integral Hecke operators whose eigenvalue on $f$ is zero. Because $\mathbb T$ is finite over $\mathbb Z$, choose $\mathbb Z$-module generators $u_1,\dots,u_r \in I_f$ and set
\begin{align*}
I_fJ_0(N) := u_1(J_0(N)) + \cdots + u_r(J_0(N)) \subset J_0(N).
\end{align*}
This is the abelian subvariety generated by the images $u(J_0(N))$ for $u \in I_f$, so it does not depend on the chosen generators. We then define
\begin{align*}
A_f := J_0(N) / I_f J_0(N).
\end{align*}
The newform quotient construction applies because $f$ is a normalised newform in $S_2(\Gamma_0(N))$, $\mathbb T$ is the Hecke algebra acting on $J_0(N)$, and $I_f$ is the integral annihilator of the eigensystem of $f$. It concludes that this quotient is an abelian variety over $\mathbb Q$, that the quotient map is defined over $\mathbb Q$, and that the rational Hecke algebra acting faithfully on this quotient is the simple factor $K_f$ selected by $\theta_f$.
[/guided]
[/step]
[step:Descend the Hecke action to an action of the coefficient field]
The Hecke action of $\mathbb T$ on $J_0(N)$ preserves $I_fJ_0(N)$, so it descends to an action of $\mathbb T/I_f$ on $A_f$. The newform quotient construction identifies the kernel of the induced rational action
\begin{align*}
\mathbb T\otimes_{\mathbb Z}\mathbb Q \longrightarrow \operatorname{End}_{\mathbb Q}(A_f)\otimes_{\mathbb Z}\mathbb Q
\end{align*}
with $\ker(\theta_f)$. Therefore the descended rational action factors faithfully through
\begin{align*}
(\mathbb T/I_f)\otimes_{\mathbb Z}\mathbb Q \cong (\mathbb T\otimes_{\mathbb Z}\mathbb Q)/\ker(\theta_f) \cong K_f.
\end{align*}
Thus the $K_f$-action is an embedding
\begin{align*}
K_f \hookrightarrow \operatorname{End}_{\mathbb Q}(A_f)\otimes_{\mathbb Z}\mathbb Q.
\end{align*}
This is the asserted action of $K_f$ on $A_f$.
[/step]
[step:Localise the Tate module at $\lambda$ and compute its dimension]
Let
\begin{align*}
T_\ell A_f := \varprojlim_m A_f[\ell^m](\overline{\mathbb Q})
\end{align*}
be the $\ell$-adic Tate module, and define
\begin{align*}
V_\ell A_f := T_\ell A_f \otimes_{\mathbb Z_\ell} \mathbb Q_\ell.
\end{align*}
The action of $K_f$ on $A_f$ makes $V_\ell A_f$ a module over $K_f\otimes_{\mathbb Q}\mathbb Q_\ell$. For the prime $\lambda$ of $K_f$ above $\ell$, let $K_{f,\lambda}$ be the completion of $K_f$ at $\lambda$, and define
\begin{align*}
V_\lambda A_f := V_\ell A_f \otimes_{K_f\otimes_{\mathbb Q}\mathbb Q_\ell} K_{f,\lambda}.
\end{align*}
By the Tate module rank computation for newform quotients, applied to the quotient $A_f$ attached to the normalised weight-two newform $f$, the module $V_\ell A_f$ is locally free of rank $2$ over $K_f\otimes_{\mathbb Q}\mathbb Q_\ell$. The algebra decomposition
\begin{align*}
K_f\otimes_{\mathbb Q}\mathbb Q_\ell \cong \prod_{\lambda'\mid \ell} K_{f,\lambda'}
\end{align*}
identifies scalar extension to $K_{f,\lambda}$ with projection to the $\lambda$-factor. Base change to that factor therefore gives
\begin{align*}
\dim_{K_{f,\lambda}} V_\lambda A_f = 2.
\end{align*}
[guided]
The point of passing to $V_\lambda A_f$ is to isolate the factor of the $\ell$-adic representation corresponding to the chosen prime $\lambda \mid \ell$. The Tate module is
\begin{align*}
T_\ell A_f := \varprojlim_m A_f[\ell^m](\overline{\mathbb Q}),
\end{align*}
and its rationalisation is
\begin{align*}
V_\ell A_f := T_\ell A_f \otimes_{\mathbb Z_\ell} \mathbb Q_\ell.
\end{align*}
Because $K_f$ acts on $A_f$, functoriality of the Tate module gives an action of $K_f\otimes_{\mathbb Q}\mathbb Q_\ell$ on $V_\ell A_f$. The completion $K_{f,\lambda}$ is one factor of this semisimple algebra, so we define the $\lambda$-component by scalar extension:
\begin{align*}
V_\lambda A_f := V_\ell A_f \otimes_{K_f\otimes_{\mathbb Q}\mathbb Q_\ell} K_{f,\lambda}.
\end{align*}
The Tate module rank computation for newform quotients applies to $A_f$ because $A_f$ is the quotient attached to a normalised weight-two newform and carries the faithful rational $K_f$-action constructed above. It states that $V_\ell A_f$ is locally free of rank $2$ over $K_f\otimes_{\mathbb Q}\mathbb Q_\ell$. Since
\begin{align*}
K_f\otimes_{\mathbb Q}\mathbb Q_\ell \cong \prod_{\lambda'\mid \ell} K_{f,\lambda'},
\end{align*}
the completion $K_{f,\lambda}$ is one factor of this product. Tensoring a locally free rank-$2$ module with this factor projects to the corresponding direct summand and preserves rank over $K_{f,\lambda}$, hence
\begin{align*}
\dim_{K_{f,\lambda}} V_\lambda A_f = 2.
\end{align*}
This verifies the dimension assertion in the theorem statement.
[/guided]
[/step]
[step:Attach the Galois representation to the $\lambda$-adic component]
The absolute [Galois group](/page/Galois%20Group) $G_{\mathbb Q}:=\operatorname{Gal}(\overline{\mathbb Q}/\mathbb Q)$ acts continuously on $T_\ell A_f$ by functoriality of torsion points. This action extends $\mathbb Q_\ell$-linearly to $V_\ell A_f$ and commutes with the Hecke action because the Hecke correspondences and the quotient map defining $A_f$ are defined over $\mathbb Q$. Hence the action preserves the $\lambda$-component and defines a continuous representation
\begin{align*}
\rho_{f,\lambda}: G_{\mathbb Q} &\to \operatorname{GL}(V_\lambda A_f).
\end{align*}
Since $V_\lambda A_f$ is two-dimensional over $K_{f,\lambda}$, this is equivalently a representation
\begin{align*}
\rho_{f,\lambda}: G_{\mathbb Q} &\to \operatorname{GL}_2(K_{f,\lambda}).
\end{align*}
[/step]
[step:Apply Eichler Shimura at primes of good reduction]
Let $p$ be a rational prime with $p \nmid N\ell$. By the Deligne-Rapoport good reduction theorem for the integral model of $X_0(N)$, the modular curve $X_0(N)$ has good reduction at every prime not dividing $N$. Therefore $J_0(N)$ has good reduction at $p$, and the quotient abelian variety $A_f$ also has good reduction at $p$. Since $p \ne \ell$, the Neron-Ogg-Shafarevich criterion implies that the $\ell$-adic representation on $V_\lambda A_f$ is unramified at $p$, so arithmetic Frobenius $\operatorname{Frob}_p \in G_{\mathbb Q}$ acts on $V_\lambda A_f$.
We use the Eichler-Shimura relation in the arithmetic Frobenius convention: on the $f$-isotypic $\lambda$-adic component of the Tate module at a prime $p \nmid N\ell$, it gives the characteristic polynomial directly as
\begin{align*}
\det_{K_{f,\lambda}}\bigl(1-X\rho_{f,\lambda}(\operatorname{Frob}_p)\bigr)=1-a_p(f)X+pX^2.
\end{align*}
Here $T_p$ acts on the quotient through the eigenvalue $a_p(f)$, and the determinant term is $p$ because the cited convention uses arithmetic Frobenius rather than geometric Frobenius. This proves the asserted Eichler-Shimura formula for every $p \nmid N\ell$.
[guided]
We now use the prime condition $p \nmid N\ell$. The condition $p \nmid N$ is where the integral model of the modular curve enters: the Deligne-Rapoport good reduction theorem for $X_0(N)$ says that $X_0(N)$ has good reduction at primes not dividing $N$. Its Jacobian $J_0(N)$ then has good reduction at $p$, and good reduction passes to the quotient abelian variety $A_f$. The condition $p \ne \ell$ allows us to apply the Neron-Ogg-Shafarevich criterion to the $\ell$-adic Tate module, so the representation on $V_\lambda A_f$ is unramified at $p$. Thus arithmetic Frobenius $\operatorname{Frob}_p$ is a well-defined conjugacy class acting on $V_\lambda A_f$.
The Eichler-Shimura relation applies under exactly these hypotheses: $p \nmid N\ell$, $A_f$ is the newform quotient of $J_0(N)$ attached to the normalised eigenform $f$, and $V_\lambda A_f$ is the corresponding $\lambda$-adic two-dimensional component. We use the version stated for arithmetic Frobenius. In that convention, after passing to the quotient where $T_p$ acts by the eigenvalue $a_p(f)$, the relation gives the characteristic polynomial itself:
\begin{align*}
\det_{K_{f,\lambda}}\bigl(1-X\rho_{f,\lambda}(\operatorname{Frob}_p)\bigr)=1-a_p(f)X+pX^2.
\end{align*}
This direct characteristic-polynomial statement is stronger than a quadratic annihilating relation and therefore does not require a separate minimal-polynomial argument. The determinant term is $p$ with arithmetic Frobenius; using geometric Frobenius would invert the Frobenius element and change the convention. Hence the displayed identity is the claimed formula for every rational prime $p$ satisfying $p \nmid N\ell$.
[/guided]
[/step]