Are there any simple characterizations of rational functions $f(x,y)$ with real coefficients such that $\theta\mapsto f(\cos\theta,\sin\theta)$ is a homeomorphism from $\mathbb R\bmod 2\pi$ to $\mathbb R\cup\{\infty\}$ (the last set being the one-point compactification)?


(The fact that $\theta\mapsto\sec\theta+\tan\theta$ is such a homeomorphism despite the fact that each term separately is two-to-one onto its image and the first does not map onto the codomain, is what first made me think of this.)



certain trigonometric homeomorphisms
The magic words are $\tan(\theta/2).$ That substitution reduces your question to asking which rational functions $\mathbb{R} \rightarrow \mathbb{R}$ are homeomorphisms. Those are precisely the functions whose derivative does not change sign, so differentiating our function we get a rational function which does not change sign. This is true if and only if both the numerator and denominator do not change sign, so let's just say they stay positive (or non-negative if you want homeo instead of diffeo). A polynomial is nonnegative on the real line if and only if it is the sum of (two) squares. 


So, there you have it.


**sum of two squares** to express a nonnegative polynomial as a sum of two squares, factor it over $\mathbb{C}.$ It will have either real roots of even multiplicity or conjugate complex roots. A quadratic polynomial with no real roots can be written as a sum of two squares ("completing the square"), an even power of a polynomial can be written as a sum of two squares (one of which is $0$), and now note that the product of sums of two squares is likewise a sum of two squares (think of norms)


**sigh** to complete the answer, note that if the rational function has a pole, it can only have *one simple* pole (otherwise, the map is not $1$-$1$ at infinity), furthermore, the limits at $\pm \infty$ have to be equal and finite. Suppose that pole is at $x=a.$ Precompose your function by a linear fractional $\phi$ which sends infinity to $a$ - $x \mapsto \frac{a x}{x+ a + 1}$ is my personal favorite. Now, you have a rational function which sends infinity to infinity, so you can apply what I had said before.


