How many pairs of polynomials $(U,V)\in \Bbb Z[x]^2$ such that $P=U^2+V^2$ for a given polynomial with integer coefficients? This question is no more than curiosity question.
For integers we know that a positive integer $n$ is a sum of two squares if and only if for any prime $p$ such that $p\equiv 3 \mod 4$ we have $v_p(n)$ is even, and we know also that the number of possible representations $n=x^2+y^2$ is $r_2(n)=4(d_{4,1}(n)-d_{4,3}(n))$. 
My question asks for similar results for other rings $\Bbb Z[x]$ for example

Given a polynomial $P\in \Bbb Z[x]$ how many pairs of polynomials $(U,V)\in \Bbb Z[x]^2$ such that $P=U^2+V^2$

This can be interpreted in $\Bbb Z[i][x]$ as a factorization of $P$ but the problem is how many divisors $P$ in $\Bbb Z[i][x]$ may have, for example:
$x^2+1=(x+i)(x-i)=(x^2+1)1 $
 A: Yes, there are similar results for polynomials in $\mathbb{Z}[x]$. The first observations is, that we need $P(x)\ge 0$ in order to represent $P$ as the sum of two squares in $\mathbb{Z}[x]$. There is the following result of Davenport, Lewis and Schinzel, which reduces the question to sum of  two squares in $\mathbb{Z}$.

If $f(x)$ is a polynomial with integer coefficients such that every
  arithmetic progression contains an integer $n$ for which $f(n)$ is a
  sum of two squares, then $f(x) = u(x)^2+v(x)^2$ where $u$ and $v$ are
  polynomials with integer coefficients.

A: Writing $P(x) = U(x)^2+V(x)^2$ is the same as writing $P(x) = (U(x)+i V(x))(U(x)-i V(x))$. Factor $P(x)$ over the UFD $\mathbb{Z}[i][x]$ as 
$$i^s (1+i)^t \prod_i \pi_i^{a_i} \overline{\pi_i}^{a_i} \prod_j q_j^{b_j} \prod_k \phi_k(x)^{c_k} \overline{\phi_k}(x)^{c_k} \prod_{\ell} g_{\ell}(x)^{d_{\ell}} \quad (\ast)$$
where 


*

*the $\pi_i$ are Gaussian primes not in $\mathbb{Z} \cup i \mathbb{Z}$

*the $q_j$ are integer primes

*the $\phi_k(x)$ are primitive irreducible polynomials in $\mathbb{Z}[i][x]$ not in $\mathbb{Z}[x] \cup i \mathbb{Z}[x]$

*the $g_{\ell}(x)$ are primitive irreducible polynomials in $\mathbb{Z}[x]$.
In order to write $P(x)$ as $(U(x)+iV(x))(U(x)-iV(x))$, we have to split the factors in $(\ast)$ into two complex conjugate sets. In order to be able to do this at all, we have the following necessary conditions:


*

*The $b_j$ and $d_{\ell}$ are all even. Note that this forces all real roots of $P$ to have even multiplicity, so $P(x) \geq 0$ or $P(x) \leq 0$ for all $x$.

*$2s+t \equiv 0 \bmod 8$. In the context of the previous condition, this is equivalent to $P(x) \geq 0$ for all $x$.
Assuming these conditions hold, I get that there are
$$4 \prod_i (a_i+1) \prod_{k} (c_k+1)$$
different ways to factor $P(x) = (U(x)+iV(x))(U(x) - i V(x))$. The factor of $4$ comes from choosing which power of $i$ to put on each factor.
