II. (50 points) Let $x_{i} \in[1,3], i=1,2, \cdots$, 2007, and $\sum_{i=1}^{2007} x_{i}=5988$. Try to find the maximum value of $\sum_{i=1}^{2007} x_{i}^{2008}$ and the values of $x_{i}(i=1,2, \cdots, 2007)$ at this time.
$$
\begin{array}{l}
\text { For } 1 \leqslant x_{k} \leqslant x_{j} \leqslant 3, \text { let } \\
h=\min \left\{x_{k}-1,3-x_{j}\right\}, \\
x_{k}^{\prime}=x_{k}-h, x_{j}^{\prime}=x_{j}+h,
\end{array}
$$

the rest of $x_{i}^{\prime}=x_{i}$. Then $x_{i}^{\prime}, x_{k}^{\prime}, x_{j}^{\prime} \in[1,3]$, and we have
$$
\begin{array}{l}
\sum_{i=1}^{2007} x_{i}^{\prime}=\sum_{i=1}^{2007} x_{i}=5988, \text { and clearly } h \geqslant 0 . \\
\text { Therefore, }\left(x_{j}+h\right)^{2008}+\left(x_{k}-h\right)^{2008} \\
=x_{j}^{2008}+x_{k}^{2008}+ \\
\sum_{i=1}^{1004}\left[C_{2008}^{2 i}\left(x_{j}^{2008-2 i}+x_{k}^{2008-2 i}\right) h^{2 i}+\right. \\
\left.\sum_{i=1}^{2007} x_{i}^{\prime 2008}\left(x_{j}^{2009-2 i}-x_{k}^{2009-2 i}\right) h^{2 i-1}\right], \\
=\sum_{i=1}^{2007} x_{i}^{2008}+\sum_{i=1}^{1004}\left[\mathrm{C}_{2008}^{2 i}\left(x_{j}^{2008-2 i}+x_{k}^{2008-2 i}\right) h^{2 i}+\right. \\
\left.C_{2008}^{2 i-1}\left(x_{j}^{2009-2 i}-x_{k}^{2009-2 i}\right) h^{2 i-1}\right] \\
\geqslant \sum_{i=1}^{2007} x_{i}^{2008} .
\end{array}
$$

It is evident that for $x_{i}$ in $[1,3]$, when the smaller number decreases and the larger number increases, the value of $\sum_{i=1}^{2007} x_{i}^{2008}$ increases. Therefore, the $x_{i}$ that maximize $\sum_{i=1}^{2007} x_{i}^{2008}$ can have at most one value that is neither 1 nor 3.

Assume that the $x_{1}, x_{2}, \cdots, x_{2007}$ that maximize $\sum_{i=1}^{2007} x_{i}^{2008}$ contain $p$ ones and $q$ threes.
If $p+q=2007$, then
$$
\begin{array}{l}
\sum_{i=1}^{2007} x_{i}=p+3 q=6021-2 p(\text { odd number }) \\
\neq 5988 ;
\end{array}
$$

If $p+q=2006$, then
$$
\begin{array}{l}
\sum_{i=1}^{2007} x_{i}=p+3 q+u=6018-2 p+u \\
=5988(1<u<3),
\end{array}
$$

which gives $2 p-u=30$, leading to $p=16, u=2, q=1990$.
Therefore, the $x_{1}, x_{2}, \cdots, x_{2007}$ that maximize $\sum_{i=1}^{2007} x_{i}^{2008}$ contain 16 ones, 1990 threes, and 1 two.
$$
\begin{array}{l}
\text { Hence, }\left(\sum_{i=1}^{2007} x_{i}^{2008}\right)_{\max } \\
=16 \times 1^{2008}+1990 \times 3^{2008}+2^{2008} \\
=16+1990 \times 3^{2008}+2^{2008} .
\end{array}
$$