Let $K$ be an imaginary quadratic number field and $\mathcal{O}_K$ its ring of integers. Let $\chi$ be an algebraic Hecke character on $K$ with conductor $\mathfrak{f}$ and infinity type $(a,b)$, i.e.
$$ \chi (\mathfrak{a}) = \epsilon(\alpha)\chi_\infty^{-1}(\alpha) = \epsilon(\alpha) \cdot \alpha^a \overline{\alpha}^b $$
where $\mathfrak{a}=(\alpha)$ for all $\alpha \in K^\times$ and $(\mathfrak{a},\mathfrak{f})=1$ and a finite order character $$ \epsilon : (\mathcal{O}_K/\mathfrak{f})^\times \longrightarrow \mathbb{S}^1 $$
One has an associated Hecke $L$-function
\begin{equation}
L(s,\chi) = \sum\limits_{\substack{0 \neq \mathfrak{a} \lhd \mathcal{O}_K \\ (\mathfrak{a},\mathfrak{f})=1 }} \frac{\chi(\mathfrak{a})}{N(\mathfrak{a})^s}
\end{equation}
Which is absolutely convergent on $\lbrace z \in \mathbb{C} \, | \, \operatorname{Re}(s) > \frac{a+b}{2}+1 \rbrace$. Let $P_\mathfrak{f}:= \lbrace \mathfrak{a}=(\alpha) \text{ principal fractional ideals } \: | \: \alpha \equiv 1 \: \operatorname{mod}^* \: \mathfrak{f} \rbrace$ the subgroup of $I(\mathfrak{f}):= \lbrace \mathfrak{a} \text{ fractional ideals of } K \: | \: (\mathfrak{a},\mathfrak{f})=1 \rbrace$.
I am reading a paper and the author writes for $a \in \mathbb{N}$, $s > \frac{a}{2}+1$
\begin{align} L(s,\overline{\chi}^a) = \sum\limits_{\substack{0 \neq \mathfrak{a} \lhd \mathcal{O}_K \\ (\mathfrak{a},\mathfrak{f})=1 }} \frac{\overline{\chi}^a(\mathfrak{a})}{N(\mathfrak{a})^s} \underset{(1)}{=}& \frac{1}{\omega_\mathfrak{f}} \sum\limits_{\mathfrak{a} \in I(\mathfrak{f})/P_\mathfrak{f}} \frac{\overline{\chi}^a(\mathfrak{a})}{N(\mathfrak{a})^s} \sum\limits_{\substack{\alpha \in \mathfrak{a}^{-1} \\ \alpha \equiv 1 \: \operatorname{mod}^* \: \mathfrak{f} }}\frac{\overline{\chi}^a(\mathfrak{a})}{|\alpha|^{2s}} \\ \underset{(2)}{=}& \frac{1}{\omega_\mathfrak{f}} \sum\limits_{\mathfrak{a} \in I(\mathfrak{f})/P_\mathfrak{f}} \; \sum\limits_{\gamma \in \mathfrak{a}^{-1}\mathfrak{f}}\frac{(\overline{\chi(\alpha_\mathfrak{a} \mathfrak{a}) + \chi(\mathfrak{a})\gamma})^a}{|\chi(\alpha_\mathfrak{a} \mathfrak{a}) + \chi(\mathfrak{a})\gamma|^{2s}} \end{align}
Here he says that $\omega_\mathfrak{f}$ is the number of roots of unity in $K$ that are congruent to $1$ modulo $\mathfrak{f}$.
I don't understand from where it comes from, nor how he gets the equalities (1) and (2)... If anyone can help explaining, it would be very much appreciated.
P.S: Why does one have $|\chi(\mathfrak{a})|^2=N(\mathfrak{a})$ in (1) ?
When $\psi$ is a character of $C_K$ then $$L(s,\psi ) =\sum_{0\ne I\subset O_K} \psi(I)N(I)^{-s}= \sum_{c\in C_K} \psi(c) \sum_{I\subset O_K,I\sim c} N(I)^{-s} $$ $$= \sum_{c\in C_K} \psi(c) \sum_{b\in (J_c-0)^{-1}/O_K^\times} N(J_c b)^{-s} = \sum_{c\in C_K} \psi(c)N(J_c)^{-s} \sum_{b\in (J_c-0)^{-1}/O_K^\times} |N_{K/Q}( b)|^{-s}$$
where $J_c$ is any fixed ideal in the class $c$.
(this is because $I$ is in the same class as $J_c$ iff $I = b J_c$ with $0\ne b\in J_c^{-1} = \{ d\in K, dJ_c\subset O_K\}$)
In your question it works the same way except that $\psi$ is a character of the class group of an order multiplied by a character of infinite place, and $O_K^\times$ is finite because $K$ is an imaginary quadratic field.
The point of doing so is that $\sum_{b\in (J_c-0)^{-1}/O_K^\times} |N_{K/Q}( b)|^{-s}$ is the Mellin transform of some kind of $\theta$ function.