9. Given the sets $M=\{x, x y, \lg x y\}, N=\{0,|x|, y\}$, and $M=N$, then the value of $\left(x+\frac{1}{y}\right)+\left(x^{2}+\frac{1}{y^{2}}\right)+\left(x^{3}+\right.$ $\left.\frac{1}{y^{3}}\right)+\cdots+\left(x^{2 n+1}+\frac{1}{y^{2 n+1}}\right)$ is $\qquad$.
9. From the equality of sets, we know that the elements of the two sets are the same. Thus, there must be an element 0 in $M$. Also, by the definition of logarithms, $x y \neq 0$, so $x, y$ are not zero. Therefore, only $\lg x y=0$, which means $x y=1$. Then, $M=\{x, 1,0\}, N=\left\{0,|x|, \frac{1}{x}\right\}$. By $M=N$, we can get
$$
\left\{\begin{array} { l } 
{ x = | x | , } \\
{ 1 = \frac { 1 } { x } }
\end{array} \quad \text { or } \left\{\begin{array}{l}
x=\frac{1}{x}, \\
1=|x| .
\end{array}\right.\right.
$$

However, when $x=1$, it contradicts the distinctness of elements in the same set, so only $x=-1$, and thus $y=-1$. At this point, $M=N=\{-1$, $1,0\}$, and we have
$$
x^{2 k}+\frac{1}{y^{2 k}}=2, x^{2 k+1}+\frac{1}{y^{2 k+1}}=-2
$$

Therefore, $\left(x+\frac{1}{y}\right)+\left(x^{2}+\frac{1}{y^{2}}\right)+\left(x^{3}+\frac{1}{y^{3}}\right)+\cdots+\left(x^{2001}+\frac{1}{y^{2001}}\right)=-2$.