Let:
\[ Z = \frac{1 + i \cos \theta}{1 - 2i \cos \theta}. \]
For \( Z \) to be purely imaginary:
\[ Z + \overline{Z} = 0, \]
where \( \overline{Z} \) is the complex conjugate of \( Z \). Thus:
\[ Z + \overline{Z} = \frac{1 + i \cos \theta}{1 - 2i \cos \theta} + \frac{1 - i \cos \theta}{1 + 2i \cos \theta} = 0. \]
Simplify:
\[ (1 + i \cos \theta)(1 - 2i \cos \theta) + (1 - i \cos \theta)(1 + 2i \cos \theta) = 0. \]
Expand both terms:
\[ (1 + i \cos \theta)(1 - 2i \cos \theta) = 1 - 2i \cos \theta + i \cos \theta - 2 \cos^2 \theta, \]
\[ (1 - i \cos \theta)(1 + 2i \cos \theta) = 1 + 2i \cos \theta - i \cos \theta - 2 \cos^2 \theta. \]
Combine:
\[ (1 - 2i \cos \theta + i \cos \theta - 2 \cos^2 \theta) + (1 + 2i \cos \theta - i \cos \theta - 2 \cos^2 \theta) = 0. \]
Simplify further:
\[ 2 - 4 \cos^2 \theta = 0. \]
Solve for \( \cos^2 \theta \):
\[ \cos^2 \theta = \frac{1}{2}. \]
Step 2: Find all possible values of \( \theta \). If \( \cos^2 \theta = \frac{1}{2} \), then:
\[ \cos \theta = \pm \frac{1}{\sqrt{2}}. \]
The possible values of \( \theta \in [-\pi, \pi] \) are:
\[ \theta = \pm \frac{\pi}{4}, \pm \frac{3\pi}{4}. \]
Step 3: Sum of all possible values
\[ \text{Sum} = \frac{\pi}{4} + \left( -\frac{\pi}{4} \right) + \frac{3\pi}{4} + \left( -\frac{3\pi}{4} \right) = 3\pi. \]
Final Answer: \( 3\pi \).