$\det (\rho)$ is a one dimensional rep of the absolute Galois group of the rationals, i.e., it is a character. All such characters can be described by class field theory or, more simply, by the Kronecker-Weber theorem. So is a Dirichlet character and, by the hypotheses, its conductor divides $pN$. Factor it as a character of conductor $p$ (that will be $\epsilon$) times a character of conductor $N$. The latter is a power of the cyclotomic character and $k$ is defined to be that power. The bit about quadratic character must be under additional hypotheses.
Edit: I got $p$ and $N$ switched above. The character of conductor $N$ is $\epsilon$. The character of conductor $p$ is a power of the cyclotomic character because $(\mathbb{Z}/p)^*$ is cyclic.

