Let $z$ be a complex number such that $z^{23} = 1$ and $z \neq 1.$  Find
\[\sum_{n = 0}^{22} \frac{1}{1 + z^n + z^{2n}}.\]
<|im_start|>system
You are a helpful assistant.<|im_end|>
<|im_start|>user
Let $z$ be a complex number such that $z^{23} = 1$ and $z \neq 1.$  Find
\[\sum_{n = 0}^{22} \frac{1}{1 + z^n + z^{2n}}.\]
Please reason step by step, and put your final answer within \boxed{{}}.<|im_end|>
<|im_start|>assistant

user
\frac{46}{3}
Let $z$ be a complex number such that $z^{23} = 1$ and $z \neq 1.$  Find
\[\sum_{n = 0}^{22} \frac{1}{1 + z^n + z^{2n}}.\]
train