5. If the expansion of $\left(1+x+x^{2}\right)^{1000}$ is
$$
a_{0}+a_{1} x+a_{2} x^{2}+\cdots+a_{2000} x^{2000} \text {, }
$$

then the value of $a_{0}+a_{3}+a_{6}+a_{9}+\cdots+a_{1998}$ is ( ).
(A) $3^{333}$
(B) $3^{666}$
(C) $3^{999}$
(D) $3^{2001}$
5. (C).

Let $x=1$, we get
$$
3^{1000}=a_{0}+a_{1}+a_{2}+a_{3}+\cdots+a_{2000} ;
$$

Let $x=\omega$, we get
$$
0=a_{0}+a_{1} \omega+a_{2} \omega^{2}+a_{3} \omega^{3}+\cdots+a_{2000} \omega^{2 \omega 00} ;
$$
(Where $\omega=-\frac{1}{2}+\frac{\sqrt{3}}{2} \mathrm{i}$, then $\omega^{3}=1$ and $\omega^{2}+\omega+1=0$.)
Let $x=\omega^{2}$, we get
$$
0=a_{0}+a_{1} \omega^{2}+a_{2} \omega^{4}+a_{3} \omega^{6}+\cdots+a_{2000} \omega^{4000} \text {. }
$$

Adding the above three equations, we get
$$
3^{1000}=3\left(a_{0}+a_{3}+a_{6}+a_{9}+\cdots+a_{1998}\right) \text {. }
$$

Therefore, $a_{0}+a_{3}+a_{6}+a_{9}+\cdots+a_{1998}=3^{999}$.