4. Given that the pure imaginary numbers $x_{1}, x_{2}, \cdots, x_{1999}$ have a modulus of 1. Then the remainder when $x_{1} x_{2}+x_{2} x_{3}+\cdots+x_{1998} x_{1999}+x_{1999} x_{1}$ is divided by 4 is $\qquad$
4.1.

Obviously, if $x_{k}$ takes $i$ or $-i$, we have
$$
\begin{array}{l}
\left(i+x_{k}\right)\left(i-x_{k+1}\right) \\
=\left\{\begin{array}{l}
0, \text{ when } x_{k}=-i \text{ or } x_{k+1}=i; \\
-4, \text{ when } x_{k}=i \text{ and } x_{k+1}=-i
\end{array}\right.
\end{array}
$$

Both are multiples of 4, so the sum is also a multiple of 4. Therefore,
$$
\begin{aligned}
4 m= & \left(i+x_{1}\right)\left(i-x_{2}\right)+\left(i+x_{2}\right)\left(i-x_{3}\right) \\
& +\cdots+\left(i+x_{1999}\right)\left(i-x_{1}\right) \\
= & -1999+\left(x_{1}+x_{2}+\cdots+x_{1999}\right) i \\
& -\left(x_{1}+x_{2}+\cdots+x_{1999}\right) i \\
& -\left(x_{1} x_{2}+x_{2} x_{3}+\cdots+x_{1999} x_{1}\right) .
\end{aligned}
$$

Thus,
$$
\begin{array}{l}
x_{1} x_{2}+x_{2} x_{3}+\cdots+x_{1999} x_{1} \\
=-4 m-1999=4(-m-500)+1 .
\end{array}
$$

It is evident that the above expression, when divided by 4, leaves a remainder of 1.
Note: As a fill-in-the-blank question, we can take $x_{k}=(-1)^{k-1} i$, then
$$
\text { original expression }=1+1+\cdots+1-1=1997=4 \times 499+1 \text {. }
$$

Or take $x_{1}=x_{2}=\cdots=x_{1999}=i$, then
$$
\text { original expression }=-1999=4 \times(-500)+1 \text {. }
$$

From this, we conjecture that the original expression, when divided by 4, leaves a remainder of 1.