Let
\begin{equation}
Z=\int \mathrm e^{-{\bar\psi}^i\not D_{ij}\psi_j}\ \mathrm d\psi\mathrm d\bar\psi
\end{equation}
be the (euclidean) partition function

As discussed in the references, the anomaly is given by the Jacobian of the transformation. Moving into momentum space for simplicity, and following Fujikawa, we arrive at the expression

\begin{equation}
\partial\cdot j_A=2\lim_{\Lambda\to\infty}\Lambda^d\int\frac{\mathrm d^dk}{(2\pi)^d}\ \mathrm e^{-k^2}\text{tr}\left(\gamma^5\exp\left[-\frac{2ik\cdot D+\not D^2}{\Lambda^2}\right]\right)
\end{equation}
where $j_A$ is the axial current and $\Lambda$ is a regulator.

We note that when expanding the exponential in series in $\Lambda^{-2}$, we only need to keep the term $\not D^d$, because the rest either vanish on account of the gamma matrices properties, or vanishes in the limit $\Lambda\to\infty$. We therefore need to compute
\begin{equation}
\frac{1}{(d/2)!}\text{tr}\left(\gamma_5\not D^d\right)
\end{equation}


Noting that
\begin{equation}
\text{tr}(\gamma_5\gamma^{\mu_1}\gamma^{\mu_2}\cdots\gamma^{\mu_d})=2^{d/2}\varepsilon^{\mu_1\mu_2\cdots\mu_d}
\end{equation}
we get
\begin{equation}
\begin{aligned}
\text{tr}\left(\gamma_5\not D^d\right)&=2^{d/2}\varepsilon^{\mu_1\mu_2\cdots\mu_d}\text{tr}\left(D_{\mu_1}D_ {\mu_2}\cdots D_{\mu_d}\right)\\
&=\varepsilon^{\mu_1\mu_2\cdots\mu_d}\text{tr}\left([D_{\mu_1},D_ {\mu_2}]\cdots [D_{\mu_{d-1}},D_{\mu_d}]\right)\\
&=\varepsilon^{\mu_1\mu_2\cdots\mu_d}\text{tr}\left(F_{\mu_1\mu_2}\cdots F_{\mu_{d-1}\mu_d}\right)
\end{aligned}
\end{equation}

Finally, using
\begin{equation}
\begin{aligned}
\int\frac{\mathrm d^dk}{(2\pi)^d}\ \mathrm e^{-k^2}&=\frac{1}{(2\pi)^d}\frac{2\pi^{d/2}}{\left(\frac d2-1\right)!}\int\mathrm dk\ k^{d-1} \mathrm e^{-k^2}\\
&=\frac{1}{(4\pi)^{d/2}}
\end{aligned}
\end{equation}
we get
\begin{equation}
\partial\cdot j_A=\frac{2}{(4 \pi )^{d/2} (d/2)!}\varepsilon^{\mu_1\mu_2\cdots\mu_d}\text{tr}\left(F_{\mu_1\mu_2}\cdots F_{\mu_{d-1}\mu_d}\right)
\end{equation}

For $d=4$ we recover the standard expression, and for $d=2$ we get
\begin{equation}
\partial\cdot j_A\bigg|_{d=2}=\frac{1}{2\pi}\varepsilon^{\mu_1\mu_2}\text{tr}\left(F_{\mu_1\mu_2}\right)
\end{equation}
as required.