Closed form and generalised solutions
The piecewise function referred to in user14972's, Jyrki's and Alex's answers can be given in the closed form $$f(x)=\operatorname{sign}\left(x\right)-\left(-1\right)^{\operatorname{ceil}\left|x\right|}x$$
where $\operatorname{ceil}$ is the ceiling function. Let $n\in\mathbb{N}_0,\ \alpha\in(0,1]$, such that all $x\in\mathbb{R}^+$ can be represented by either $(2n+\alpha)$ or $(2n+1+\alpha)$. By substitution, we have $f(2n+\alpha)=2n+1+\alpha$ and $f(2n+1+\alpha)=-2n-\alpha$. Since $f$ is odd, we also have $f(-(2n+\alpha))=-(2n+1+\alpha)$ and $f(-(2n+1+\alpha))=2n+\alpha$, and therefore have the following cycle of values under $f$. Along with the trivial cycle $f(0)=0$, this proves that $f(f(x))=-x$ for all $x\in\mathbb{R}$.
$$\require{AMScd}
\begin{CD}
2n+\alpha @>>> 2n+1+\alpha\\
@AAA @VVV\\
-2n-1-\alpha @<<< -2n-\alpha
\end{CD}$$
We may generalise this solution to $f^*(x)=c\cdot f\left(\frac{x}c\right)$, for all $c\in\mathbb{R}/\{0\}$. Even more general permissible functions may be defined by defining each cycle separately, as in the figure below, where $a,b$ are arbitrary real values.
$$\require{AMScd}
\begin{CD}
a @>g>> b\\
@AAA @VVhV\\
-b @<<< -a
\end{CD}$$
The function, $g$, that transitions through the cycle can be defined quite broadly, and may not necessarily be even locally continuous. However it must not map $x$ to itself, nor $-x$, and cannot overlap with another cycle. The cycle is completed by defining $h$ as the negative inverse of $g$ and then defining both $g$ and $h$ as odd functions. For instance, if we define $g(x)=ax$ with $a>1$, we would have $h(x)=-\frac{x}{a}$ and $$f(x)=\frac{x}{2a}\left(\left(a^{2}+1\right)\left(-1\right)^{\operatorname{ceil}\left(\log_{a}\left|x\right|\right)}+a^{2}-1\right)$$
for nonzero $x$, which is admits another solution if we take $f(0)=0$. We can methodically generate solutions with this method by picking $g(x)$ as a continuous, strictly increasing function from $\mathbb{R}^+$ to itself, that is greater than $x$. If we then take a seed value $c\in\mathbb{R}^+$, we may partition $\mathbb{R}^+$ into the two disjoint sets,
$$
S_1=\bigcup_{n\in\mathbb{Z}}\ (g^{2n},g^{2n+1}],\quad
S_2=\bigcup_{n\in\mathbb{Z}}\ (g^{2n-1},g^{2n}]
$$
where $g^n$ denotes the $n$th iteration of $g$ on $c$ and where negative superscripts denote iterated inverses, e.g. $g^{-2}=g^{-1}\circ g^{-1}(c)$. We then have that whenever $x\in S_1$, $g(x)\in S_2$ and vice versa that $x\in S_2$ implies $g(x)\in S_1$. We can then define the solution $$f(x)=\begin{cases}0,&x=0\\g(x),&x\in S_1\\-g^{-1}(x),&x\in S_2\\-f(-x),&\text{else}\end{cases}$$