3. Given $n$ as a fixed positive integer. For $-1 \leqslant x_{i} \leqslant 1(i=1,2, \cdots, 2 n)$, find
$$
\sum_{1 \leqslant r<s \leqslant 2 n}(s-r-n) x_{r} x_{s}
$$

the maximum value.
3. Let $Z=\sum_{1 \leqslant r<s \leqslant 2 n}(s-r-n) x_{r} x_{s}$.

For $i=1,2, \cdots, 2 n$, since $Z$ is linear in each variable $x_{i}\left(-1 \leqslant x_{i} \leqslant 1\right)$, the maximum value of $Z$ is attained when $x_{i}=-1$ or 1. Therefore, we only need to consider the case where $x_{i} \in\{-1,1\}(i=1,2, \cdots, 2 n)$.
For $i=1,2, \cdots, 2 n$, let
$$
y_{i}=\sum_{r=1}^{i} x_{r}-\sum_{r=i+1}^{2 n} x_{r} \text {. }
$$

Then $y_{i}^{2}=\sum_{r=1}^{2 n} x_{r}^{2}+\sum_{1 \leqslant r<s \leqslant i} 2 x_{r} x_{s}+$
$$
\begin{array}{l}
\sum_{i+1 \leqslant r<s \leqslant 2 n} 2 x_{r} x_{s}-\sum_{1 \leqslant r \leqslant i<s \leqslant 2 n} 2 x_{r} x_{s} \\
\sum_{1 \leqslant r \leqslant i<s \leqslant 2 n} 2 x_{r} x_{s},
\end{array}
$$

where the last equality uses $x_{r} \in\{-1,1\}$.
Notice that for each $r<s$, when $i=1,2, \cdots, r-1, s, s+1, \cdots, 2 n$, the coefficient of $x_{r} x_{s}$ in equation (1) is 2, and when $i=r, r+1, \cdots, s-1$, the coefficient of $x_{r} x_{s}$ in equation (1) is -2. This indicates that in $\sum_{i=1}^{2 n} y_{i}^{2}$, the coefficient of $x_{r} x_{s}$ is $2(2 n-s+r)-2(s-r)=4(n-s+r)$.
Thus, summing equation (1) for $i=1,2, \cdots, 2 n$, we get
$$
\begin{array}{l}
\sum_{i=1}^{2 n} y_{i}^{2}=4 n^{2}+\sum_{1 \leq r<s \leqslant 2 n} 4(n-s+r) x_{r} x_{s} \\
=4 n^{2}-4 Z .
\end{array}
$$

Therefore, we only need to find the minimum value of $\sum_{i=1}^{2 n} y_{i}^{2}$.
Since $x_{r} \in\{-1,1\}$, $y_{i}$ is an even number.
Since $y_{i}-y_{i-1}=2 x_{i}= \pm 2$, for $i=2$, $3, \cdots, 2 n$, $y_{i-1}$ and $y_{i}$ are two consecutive even numbers.
Thus, $y_{i-1}^{2}+y_{i}^{2} \geqslant 4$.
This implies that $\sum_{i=1}^{2 n} y_{i}^{2}=\sum_{j=1}^{n}\left(y_{2 j-1}^{2}+y_{2 j}^{2}\right) \geqslant 4 n$.
Combining equations (2) and (3), we get
$$
\begin{array}{l}
4 n \leqslant \sum_{i=1}^{2 n} y_{i}^{2}=4 n^{2}-4 Z \\
\Rightarrow Z \leqslant n(n-1) .
\end{array}
$$

For odd indices $i$, take $x_{i}=1$; for even indices $i$, take $x_{i}=-1$. Then the equality in equation (3) holds. Thus, the equality in equation (4) also holds.
Therefore, the maximum value of $Z$ is $n(n-1)$.