Do there exist functions such that $f(f(x)) = -x$? I am wondering about this. A well-known class of functions are the "involutive functions" or "involutions", which have that $f(f(x)) = x$, or, equivalently, $f(x) = f^{-1}(x)$ (with $f$ bijective).
Now, consider the "anti-involution" equation $f(f(x)) = -x$. It is possible for a function $f: \mathbb{C} \rightarrow \mathbb{C}$ to have $f(f(z)) = -z$. Take $f(z) = iz$.
But what about this functional equation $f(f(x)) = -x$ for functions $f: \mathbb{R} \rightarrow \mathbb{R}$, instead of $f: \mathbb{C} \rightarrow \mathbb{C}$? Do such functions exist? If so, can any be described or constructed? What about in the more general case of functions on arbitrary groups $G$ where $f(f(x)) = x^{-1}$ (or $-x$ for abelian groups), $f: G \rightarrow G$? Can we always get such $f$? If not, what conditions must there be on the group $G$ for such $f$ to exist?

Your primary question has been asked and answered already.
Your follow-up question can be answered by similar means. The group structure on $G$ is actually irrelevant: all you're actually using is that each element is paired with an inverse.
Another way to phrase this question is that you have a group action of the cyclic group with two elements $C_2 = \{ \pm 1 \} $ acting on a set $X$. Your question amounts wondering if this can be extended to an action of $C_4 = \{ \pm 1, \pm i\}$.
The method of my answer to the other question can still be applied, with a small change.
Let $A$ be the set of all fixed points of $C_2$. That is, the set of elements such that $(-1) \cdot x = x$. Let $B$ be the set of all two-element orbits. That is, the set of all unordered pairs $\{ \{a,b\} \mid (-1) \cdot a = b \wedge a \neq b \}$.
Now, partition $A$ into sets of one or two elements each, and partition $B$ into sets of two elements each. Also choose an ordering for each unordered pair in $B$. Now,


*

*For each of the one-element partitions $\{ x \}$ of $A$, define $i \cdot x = x$

*For each of the two-element partitions $\{ x, y \}$ of $A$, define $i \cdot x = y$ and $i \cdot y = x$.

*For each two-element partition $\{ (a,b), (c,d) \}$ of $B$, define $i \cdot a = c$, $i \cdot c = b$, $i \cdot b = d$, and $i \cdot d = a$.
Every action of $C_4$ on $X$ that extends the action of $C_2$ is of the above form. (just look at the orbits: the one, two, and four-element orbits correspond to the three bullets respectively)
Thus, we can make such an extension if and only if $B$ is either infinite or finite with even order.
