A functional analogue to a finite geometric series The well-known geometric series identity $$1+x+x^2+\cdots+x^k=\frac{x^{k+1}-1}{x-1}$$ holds for all $x\ne1$ and positive integers $k$.
Now consider a real function $f(x)\ne1$ that satisfies $$1+f(x)+f(f(x))+\cdots+f^{k}(x)=\frac{f^{k+1}(x)-1}{f(x)-1}$$ for all $x\in[a,b]$ where $f^{k+1}(x)=f(f^k(x))$ and $a,b$ are real numbers such that $a<b$.
Does such an $f\not\equiv0$ exist for each $k$?

For example, the case $k=1$ is easy as we have $$1+f(x)=\frac{f(f(x))-1}{f(x)-1}\implies f(x)^2=f(f(x))\implies f(x)=x^2$$ for all $x\in[-(1-\epsilon),1-\epsilon]$ with $0<\epsilon<1$.
It is also straightforward to prove for even $k$ since $f(x)=-x$ for all $x\ge0$ yields $$1+(-x+x)+\cdots+(-x+x)=\frac{-x-1}{-x-1}$$ which is true, so the cases where $k\ge3$ is odd remain.
 A: Simply generalizing your construction, let $\zeta=\exp(2\pi i/n)$, so $\zeta+\zeta^2+\cdots+\zeta^n = 0$ (for $n \geq 2$, anyway). Set $f(x) = \zeta x$, so $f^k(x) = \zeta^k x$. Now for any $m \in \Bbb{Z}_{\geq 0}$,
$$\begin{align*}
1+f(x)+f^2(x)+\cdots+f^{mn}(x)
  &= 1 + (\zeta x + \zeta^2 x + \cdots + \zeta^n x) + \cdots + (\zeta x + \cdots + \zeta^n x) \\
  &= 1 \\
  &= \frac{\zeta^{mn+1} x - 1}{\zeta x-1} \\
  &= \frac{f^{mn+1}(x) - 1}{f(x) - 1}.
\end{align*}$$
Hence any factorization $k=mn$ gives rise to a solution.
I entirely agree with Martin R's comment that it's quite unnatural to use $1$ rather than $f^0(x) = \mathrm{id}(x) = x$.
Edit to avoid complex numbers: By the same argument, any $n$-periodic function whose average over each orbit is $0$ will work. This thread gives some inspiration to construct such a function. Namely, pick Hamel bases for $\mathbb{R}$ and $\mathbb{R}^2$ and let $g \colon \mathbb{R} \to \mathbb{R}^2$ be a $\mathbb{Q}$-linear isomorphism. Let $\phi_n \colon \mathbb{R}^2 \to \mathbb{R}^2$ be rotation by $2\pi/n$, so $\phi_n + \phi_n^2 + \cdots + \phi_n^n \equiv 0$. Then $f = g^{-1} \circ \phi_n \circ g$ is $\mathbb{Q}$-linear, $f^n = \mathrm{id}$, and $f + f^2 + \cdots + f^n \equiv 0$.
