Integral formula for the local L factor of a base changed automorphic representation Let $\Bbb A$ the ring of rational adeles and let $\pi=\bigotimes_{p\leq\infty}\pi_p$ be an automorphic (cuspidal) representation of ${\rm GL}_2(\Bbb A)$. Fix a quadratic extension $K\supset\Bbb Q$. Then there exists an automorphic representation $\pi_K$ of ${\rm GL}_2(\Bbb A\otimes_{\Bbb Q}K)$ (known as the base-change of $\pi$ to $K$) which is characterized by the identity
$$
L(\pi_K,s)=L(\pi,s)L(\pi\otimes\eta_K,s)
$$
of $L$-functions, where $\eta_K$ is the character of $\Bbb A^\times$ attached to $K$, namely that corresponding to the Hecke character taking value $1$ at split primes and vale $-1$ at inert primes.
So if I understand things correctly when $p$ is a prime which is unramified both for $\pi$ and $K$ the local $L_p$ factor is explicitely given by
$$
L_p(\pi_K,s)=\begin{cases}
\left(\frac1{1-\mu_1(p)p^{-s}}\right)^2\left(\frac1{1-\mu_2(p)p^{-s}}\right)^2 & \text{if $p$ splits in $K$}\\
\frac1{1-\mu_1(p)^2p^{-2s}}\frac1{1-\mu_2(p)^2p^{-2s}} & \text{if $p$ is inert in $K$}
\end{cases}.
$$
where $\pi_p\simeq\pi(\mu_1,\mu_2)$ as a principal series.
Now, I came across the formula
$$
L_p(\eta_K,2s)^{-1}L_p(\pi_K,s)=\int_{\Bbb Z_p-\{0\}}
\frac{\mu_1(ap)-\mu_2(ap)}{\mu_1(p)-\mu_2(p)}|a|^{s-{\frac12}}d^\times a
$$
given very matter-of-factly but I am not sure how to derive it. Can anyone give a hint?

This is too long to fit into the comment section - but really is one... Does the following agree with your calculations?
Doing the obvious, and evaluating (as you probably have done) the integral... Call the integral $I(s)$.
Assume that $\mu_1$ and $\mu_2$ are unramified at $p$.
$$
\begin{align}
I( s  ) &=   \int_{ \mathbb Z_p - \{0\} } \frac { \mu_1(ap)-\mu_2(ap) } {   \mu_1(p)-\mu_2(p) } |a|^{s-1/2} \, d^*a \\
  &=   \frac {1} {  \mu_1(p)-\mu_2(p) }  \left( \mu_1(p)J_{\mu_1}(s) - \mu_2(p) J_{\mu_2}(s) \right), \\
\end{align}
$$
where 
$$
\begin{align} 
 J_{\mu} (s) &= \int_{\mathbb Z_p - \{0\}} \mu(a)|a|^{s-1/2}\, d^*a \\
    &= \sum_{k=0}^\infty \int_{p^k\mathbb Z_p^*} \mu(a)|a|^{s-1/2}\, d^*a \\
       &= \sum_{k=0}^\infty \int_{\mathbb Z_p^*} \mu(p^ka)|p^ka|^{s-1/2}\, d^*a. \\
\end{align}
$$
The last equality holds because $d^*a$ is multiplicative Haar measure.
Now, if $a$ a unit,  $ |p^ka| = p^{-k} $, and  $\mu (p^ka) = \mu(p)^k$ for $\mu$ unramfied. Therefore, the integrand(s) does not (do not) depend  on $a$.
So, since $d^*a$  gives the units volume $1$, one has
$$
\begin{align}
 J_\mu(s) &= \sum_{k=0 }^\infty \left( \frac{\mu(p) } { p^{s-1/2}} \right)^k \cdot \int_{\mathbb Z_p^*} \,d^*a\\
    &= \sum_{k=0 }^\infty \left( \frac{\mu(p) } { p^{s-1/2}} \right)^k\\
    &= \frac{1 } {  1 - \frac{\mu(p) }{ p^{s-1/2} } }.\\
\end{align}
$$
Therefore
$$\begin{align}
I(s) &=   \frac {1} { \mu_1(p)-\mu_2(p)}   \left( \frac{\mu_1(p) }{ 1 - \frac{\mu_1(p)}{  p^{s-1/2} } } - \frac{\mu_2(p) }{1 - \frac{\mu_2(p) }{ p^{s-1/2} } }  \right) \\
  &=   \frac{1 }{  1 - \frac{\mu_1(p) }{ p^{s-1/2} } } \cdot \frac{1}{1 - \frac{\mu_2(p)} { p^{s-1/2} } }.
\end{align}
$$ 
The claim is that 
$$ L_p(\pi_K, s) = I(s) L_p(\eta_K,2s). $$
Now, suppose $p$ is inert.
Then, one should have
$$ \frac{1}{ 1-\frac{\mu_1(p)^2}{p^{2s} } } \cdot \frac{1}{ 1-\frac{\mu_2(p)^2}{p^{2s} } }\overset{?}{=} 
\frac{1 }{  1 - \frac{\mu_1(p) }{ p^{s-1/2} } } \cdot \frac{1}{1 - \frac{\mu_2(p)} { p^{s-1/2} } }
\cdot \frac 1 {1+ \frac{1}{p^{2s}}}. 
$$
I don't see how this can be - if I haven't made a mistake. Anybody care to comment?
Where did the claim appear?
