Can the Identity Map be a repeated composition one other function?
Consider the class of Möbius transformations: $$f(x) = {ax+b\over cx+d}$$ for some constants $a,b,c,d$. If we represent Möbius transformation $f$ by its matrix of coefficients: $$\hat f = \pmatrix{ a&b \\ c&d }$$ then it turns out that to compose two Möbius transformations $f$ and $g$ we just multiply their corresponding matrices.
In particular, if $f$ is a Möbius transformation with matrix $\hat f$, then $f(f(f(x)))$ is also a Möbius transformation, with matrix ${\hat f}{}^3$.
So it suffices to find a $2\times 2$ matrix $M$ with $M^3 = I$. There are numerous examples, but one such is $$\def\ang{{\frac{2\pi}3}}\pmatrix{\cos\ang & \sin\ang \\ -\sin\ang & \cos\ang} = \pmatrix{-\frac12 & \frac{\sqrt3}2 \\ -\frac{\sqrt3}2 & -\frac12 }.$$ This is just the matrix for the linear transformation of the plane that rotates the plane by a one-third turn about the origin.
So the corresponding Möbius transformation with period 3 is $$f(x) = {x-\sqrt 3\over x\sqrt3 + 1}.$$
By replacing $2\pi\over 3$ with $2\pi\over n$, you can construct a function with any period you want.
Note that you are not restricted to $M$ with $M^3 = I$. Since $I$ and $kI$ are the same when considered as Möbius transformation, $M^3 = kI$ will work for any $k$.
The function $$f(x) = {1\over 1-x}$$ has $f^3(x) = x$ for all $x$ where $f^3(x)$ is defined. (All reals except for 0 and 1.)
Other than the identity, there is no continuous function $\Bbb R\to \Bbb R$ having $f^3(x) = x$ for all $x$, by Sharkovskii's theorem.
Consider the function $f:\mathbb R\to\mathbb R$ such that $f(i)=i+1$ for all $i\in\{1,\dots,p-1\}$, $f(p)=1$ and $f(x)=x$ for all $x\in\mathbb R\setminus\{1,\dots,p\}$.