Parity Anomaly and Gauge Invariance In Fermionic Path Integral and Topological Phases, Witten shows that in $2+1$ dimensions, the free massless Dirac fermion suffers from parity anomaly. To be specific, he shows that it is impossible to quantize the theory that preserves the classical parity symmetry and maintain gauge invariance simultaneously.
To begin with, let $D_{\mu}=\partial_{\mu}+iA_{\mu}$, where $A$ is some $U(1)$ background gauge field. Let $\left\{\eta_{\mu\nu}\right\}=\mathrm{diag}(+1,-1,-1)$ be the spacetime metric. The Lagrangian of the Dirac fermion is given by
$$S[\bar{\psi},\psi;A]=\int d^{3}x\bar{\psi}iD\!\!\! /\,\psi.$$
Classically, this theory is gauge invariant under 
$$A\rightarrow A+d\Lambda,$$
$$\bar{\psi}\rightarrow \bar{\psi}e^{i\Lambda},\quad\psi\rightarrow\psi e^{-i\Lambda},$$
and is invariant under a discrete parity ($\mathbb{Z}_{2}$) symmetry, which sends $(t,x,y)$ to $(t,x,-y)$, and
$$A_{0}(t,x,y)\rightarrow A^{\mathrm{P}}_{0}(t,x,y)=A_{0}(t,x,-y),$$
$$A_{1}(t,x,y)\rightarrow A^{\mathrm{P}}_{1}(t,x,y)=A_{1}(t,x,-y),$$
$$A_{2}(t,x,y)\rightarrow A^{\mathrm{P}}_{2}(t,x,y)=-A_{2}(t,x,-y),$$
$$\psi(t,x,y)\rightarrow\psi^{\mathrm{P}}(t,x,y)=\gamma^{2}\psi(t,x,-y),$$
$$\bar{\psi}(t,x,y)\rightarrow\bar{\psi}^{\mathrm{P}}(t,x,y)=\bar{\psi}(t,x,-y)\gamma^{2},$$ 
where $\gamma^{0}=\bigg(
\begin{matrix}
1&0\\0&-1 
\end{matrix}
\bigg)$, $\gamma^{1}=\bigg(
\begin{matrix}
0&i\\i&0 
\end{matrix}
\bigg)$, $\gamma^{2}=\bigg(
\begin{matrix}
0&1\\-1&0 
\end{matrix}
\bigg)$.
Thus, under this $\mathbb{Z}_{2}$ transformation, one has
$$\int dt\int dx\int_{-\infty}^{+\infty}dy\bar{\psi}iD\!\!\! /\,\psi$$
$$\rightarrow\int dt\int dx\int_{+\infty}^{-\infty}d(-y)\bar{\psi}(t,x,-y)\gamma^{2}(i\gamma^{0}D_{0}+i\gamma^{1}D_{1}+i\gamma^{2}\partial_{2}+\gamma^{2}A_{2})\gamma^{2}\psi(t,x,-y)$$
where $\partial_{2}=\frac{\partial}{\partial y}$. 
Thus one has,
$$\int dt\int dx\int_{-\infty}^{+\infty}dy\bar{\psi}iD\!\!\! /\,\psi$$
$$\rightarrow\int dt\int dx\int_{-\infty}^{+\infty}dy\bar{\psi}(t,x,-y)(i\gamma^{0}D_{0}+i\gamma^{1}D_{1}-i\gamma^{2}\partial_{2}-\gamma^{2}A_{2})\psi(t,x,-y)$$
$$=\int dt\int dx\int_{-\infty}^{+\infty}dy\bar{\psi}(t,x,-y)(i\gamma^{0}D_{0}+i\gamma^{1}D_{1}+i\gamma^{2}\partial_{-y}-\gamma^{2}A_{2})\psi(t,x,-y)$$
$$=\int dt\int dx\int_{-\infty}^{+\infty}dy\bar{\psi}(t,x,-y)(i\gamma^{0}D_{0}+i\gamma^{1}D_{1}+i\gamma^{2}(\partial_{-y}+iA_{2}))\psi(t,x,-y)$$
Replacing $-y$ by $y$ in the integral, one has
$$\int dt\int dx\int_{-\infty}^{+\infty}dy\bar{\psi}iD\!\!\! /\,\psi$$
$$\rightarrow\int dt\int dx\int_{-\infty}^{+\infty}dy\bar{\psi}(t,x,-y)(i\gamma^{0}D_{0}+i\gamma^{1}D_{1}+i\gamma^{2}(\partial_{-y}+iA_{2}))\psi(t,x,-y)$$
$$=\int dt\int dx\int_{+\infty}^{-\infty}d(-y)\bar{\psi}(t,x,-y)(i\gamma^{0}D_{0}+i\gamma^{1}D_{1}+i\gamma^{2}(\partial_{-y}+iA_{2}))\psi(t,x,-y)$$
$$=\int dt\int dx\int_{-\infty}^{+\infty}d(y)\bar{\psi}(t,x,y)(i\gamma^{0}D_{0}+i\gamma^{1}D_{1}+i\gamma^{2}(\partial_{y}+iA_{2}))\psi(t,x,y)$$
$$=\int dt\int dx\int_{-\infty}^{+\infty}dy\bar{\psi}iD\!\!\! /\,\psi$$
This proves that it has a classical $\mathbb{Z}_{2}$ symmetry. 
However, in the path integral quantization, one has a problem to determine the sign of the partition function. Formally, the partition function is given by the infinite product of all eigenvalues of the Dirac operator $iD\!\!\! /\,$, i.e.
$$Z[A]=\int\mathcal{D}{\psi}\int\mathcal{D}{\bar{\psi}}\exp\left(i\int d^{3}x\bar{\psi}iD\!\!\!/\,\psi\right)$$
$$=\mathrm{Det}(iD\!\!\! /\,)=\prod_{k}\lambda_{k},$$
where $iD\!\!\!/\,\psi_{k}=\lambda_{k}\psi_{k}$. Since the Dirac operator is Hermitian, each eigenvalue $\lambda_{k}$ is real. Since there are infnitely many positive and negative eigenvalues, one encounters a sign ambiguity of the partition function. Picking up an arbitrary gauge field $A_{0}$, one can consider a gauge transformation that sends $A_{0}$ to $A_{0}^{\Phi}$. For $s\in[0,1]$, one can construct an interpolating gauge field $A_{s}$
$$A_{s}=(1-s)A_{0}+sA_{0}^{\Phi}.$$
If the theory is gauge invariant, one should expect that the spectrum of the Dirac operator at $s=0$ is the same as at $s=1$ since the two are gauge equivalent.
Between $s=0$ and $s=1$, there can be spectral flow of Dirac operator in which some negative eigenvalues may flow through $\lambda=0$ to positve spectrum.
Then, Witten uses a Pauli-Villars regularization, adding to the Lagrangian a ghost field 
$$\mathcal{L}_{\mathrm reg}=\bar{\chi}iD\!\!\!/\,\chi+iM\bar{\chi}\chi$$
of large mass $M\rightarrow\infty$. 
Question 0: What is the purpose of the factor $i$ for the mass term? Why cannot I use real mass $M\bar{\chi}\chi$ for the Pauli-Villars regulator?
Then, following the usual computation in Anomalies and Odd Dimensions and Nakahara 13.6.1, one finds that the regularized partition function is 
$$Z[A]=|Z[A]|\exp\left(-i\pi\frac{\eta(A)}{2}\right),$$
where $\eta(A)$ is the APS eta-invariant of $A$, which roughly speaking is the number of positive eigenvalues of $A$ minus the number of negative eigenvalues of $A$. The Pauli-Villars regulator breaks the classical parity invariance, and so there is a parity anomaly for massless Dirac fermions in $2+1$ dimensions. 
Witten then claims that this partition function (equation 2.20 in the paper) is satisfactorily defined for all $A$. I guess what he means is that the regularized partition function is gauge invariant. However, I don't see any reason why this regularized partition function is gauge invariant and is well-defined. For example, consider the case when an eigenvalue, say $\lambda$, flows from negative to positive under a gauge transformation. Once it flows through $\lambda=0$, the value of $\eta(A)$ jumps by $\pm 2$, and so the partition changes a sign. Such a sign change is smooth if and only if the complex number 
$$|Z[A]|\exp\left(-i\pi\frac{\eta(A)}{2}\right)$$ 
traces a smooth path through $z=0$ on the complex plane $\mathbb{C}$. Only when the partition function is smooth can one define correlation functions. 
Question 1: How do I know that there cannot exist situations like $|z|$ or $\sqrt{z^{2}}$?
Question 2: How do I see that the spectrum at $A_{0}$ is the same as at $A_{0}^{\Phi}$ from the expression of the regularized partition function?
 A: I meant to answer this when it was first asked...
Witten is doing his path integral in Euclidean space.  The point is that in Euclidean space you want the eigenvalues of the derivative part of the Dirac equation to have a factor of $i$ compared to the "$m$" part so that the denominator in  the propagator never vanishes. Indeed the whole point of Wick rotation is to get rid of necessity of the $i\epsilon$'s that take care of the vanishing denominator that occurs in Minkowski signature. With
$$
\gamma^\mu\gamma^\nu+\gamma^\nu\gamma^\mu=
2\delta^{\mu\nu}
$$
we can  take the complete opertor to be $\gamma^\mu\partial_\mu+m$ so, with $\partial_\mu \to ip_\mu$ when acting on plane-waves,  the free-field Euclidean signature propagator becomes 
$$
\frac{1}{i \gamma^\mu p_\mu+m}= \frac{-i\gamma^\mu p_\mu+m}{p^2+m^2}.
$$
The denominator $p^2+m^2$ is now safely non-zero.
The matrix $i \gamma^\mu p_\mu$ is skew Hermitian and so has purely imaginary eigenvalues $ \pm i\sqrt{p^2}\equiv\pm i\sqrt{E^2+|{\bf p}|^2}$.   
For fermions interacting with background gauge fields, we still have a skew-hermitian derivative part for the Dirac opertor, the eigenvalues $i\lambda_n$  are pure imaginary,   and  the Matthews-Salam determinant is 
$$
{\rm Det} (\gamma^\mu \nabla_\mu+m)=\prod_n (i\lambda_n+m).
$$
Witten likes to multiply his whole action functional by $i$, so his derivative $i\gamma^\mu \nabla_\mu$  is Hermitian --- but then his  mass must be pure imaginary. The overall factor of $i$   makes no difference to anything as it just gives a constant factor tha cancels out when you compute a physical quantity. 
A: To answer you Question 0, Yes you can use a real mass regulator. In that case after regularization the parity violating part of the partition function will be
$$
\exp\left[\frac{1}{2}\lim_{M\to \infty}\sum_{i}\log \frac{\lambda_i+M}{\lambda_i-M}\right] = \exp\left[\lim_{M\to \infty}\sum_{i}\tanh^{-1}\left(\frac{M}{\lambda_i}\right)\right],
$$
as opposed to $\exp[i\tan^{-1}(M/\lambda_i)]$ you would get from an imaginary mass. But you get the same result, since
$$
\lim_{M\to \infty}\sum_{i}\tanh^{-1}\left(\frac{M}{\lambda_i}\right)=\frac{\pi i}2 \sum_{i}\mathrm{sgn}(\lambda_i)=\frac{\pi i} 2 \eta.
$$
Although $\tanh^{-1}(M/\lambda)$ itself requires some regularization, which is nothing but adding a small imaginary part to $M$.
Basically parity anomaly says no matter how you regulate the massless Dirac fermion in 3d, you violate reflection symmetry.
