Let $z=1+\cos\theta+i\sin\theta=|z|(\cos\alpha+i\sin\alpha)$ and $z'=1-\cos\theta+i\sin\theta=|z'|(\cos\alpha'+i\sin\alpha')$.
My line of reasoning is to convert the numerator and denominator to polar form, then knowing that in order for $(\frac{z}{z'})^n$ to be real, we must have $\arg(\frac{z}{z'})^n \equiv 0 \pmod{\pi}$ or more succinctly $$n(\arg(z)-\arg(z')) \equiv 0 \pmod{\pi}$$.
Determining $\arg(z) = \alpha$ and $\arg(z') = \alpha'$: $$\tan{\alpha}=\frac{\sin{\theta}}{1+\cos{\theta}}=\frac{2\sin{\frac{\theta}{2}\cos{\frac{\theta}{2}}}}{2\cos^2{\frac{\theta}{2}}}=\frac{\sin{\frac{\theta}{2}}}{\cos{\frac{\theta}{2}}}=\tan{\frac{\theta}{2}}$$ thus $\alpha = \frac{\theta}{2}$. $$\tan{\alpha'}=\frac{\sin{\theta}}{1-\cos{\theta}}=\frac{2\sin{\frac{\theta}{2}\cos{\frac{\theta}{2}}}}{2\sin^2{\frac{\theta}{2}}}=\frac{\cos{\frac{\theta}{2}}}{\sin{\frac{\theta}{2}}}=\frac{\sin{\alpha'}}{\cos{\alpha'}}$$ thus $$\sin{\alpha'}\sin{\frac{\theta}{2}}=\cos{\alpha'}\cos{\frac{\theta}{2}} \Leftrightarrow \frac{1}{2}(\cos(\alpha'-\frac{\theta}{2})-\cos(\alpha'+\frac{\theta}{2}))=\frac{1}{2}(\cos(\alpha'-\frac{\theta}{2})+\cos(\alpha'+\frac{\theta}{2}))$$ therefore $$-\cos(\alpha'+\frac{\theta}{2})=\cos(\alpha'+\frac{\theta}{2})$$. Knowing that $$\cos(\pi+\alpha'+\frac{\theta}{2})=\cos(\alpha'+\frac{\theta}{2})$$ is impossible, we take $$\cos(\pi-\alpha'-\frac{\theta}{2})=\cos(\alpha'+\frac{\theta}{2})$$ hence $$\pi-\alpha'-\frac{\theta}{2} = \alpha'+\frac{\theta}{2} \Leftrightarrow \alpha' = \frac{\pi-\theta}{2}$$.
So now we have $$\frac{1+\cos\theta+i\sin\theta}{1-\cos\theta+i\sin\theta} = \frac{|z|(\cos{\frac{\theta}{2}}+i\sin{\frac{\theta}{2}})}{|z'|(\cos{\frac{\pi-\theta}{2}}+i\sin{\frac{\pi-\theta}{2}})}$$
Here's where I have some difficulties. Supposing
$$\frac{\theta}{2}-\frac{\pi-\theta}{2} \equiv 0 \pmod{\pi}$$ therefore $$\frac{2\theta - \pi}{2} \equiv 0 \pmod{\pi} \Leftrightarrow 2\theta - \pi \equiv 0 \pmod{2\pi}$$ thus $$\theta \equiv \frac{\pi}{2} \pmod{\pi}$$.
However, for all $n$ and using the above condition, $$(\frac{1+\cos\theta+i\sin\theta}{1-\cos\theta+i\sin\theta})^n = 1$$
It can't be for all $n$, there's something here I'm missing.
Easier is to simplify the denominator using conjugates. \begin{align*} &\frac{1 + \cos \theta + \mathrm{i} \sin \theta}{1 - \cos \theta + \mathrm{i} \sin \theta} \cdot \frac{1 - \cos \theta - \mathrm{i} \sin \theta}{1 - \cos \theta - \mathrm{i} \sin \theta} \\ &\quad{}= \frac{2 \sin \theta}{2 - 2 \cos \theta} (-\mathrm{i} \cos \theta + \sin \theta) \text{,} \end{align*} which is the product of a real number and a complex number of magnitude $1$. The denominator of the real number explains the constraint in the problem statement, so that division by zero is avoided.
It is worth noting $$ (-\mathrm{i} \cos \theta + \sin \theta)^n = \frac{(\cos \theta + \mathrm{i} \sin \theta)^n}{\mathrm{i}^n} \text{.} $$ When $n$ is even, this denominator is real, so you only require the numerator be real. When $n$ is odd, the denominator is pure imaginary, so you only require the numerator be pure imaginary...