There are many such functions $f$, probably too many to classify in any useful way.
First, if $A\subseteq \mathbb{R}$ and $f:A\to\mathbb{R}$, say that $f$ is good if it satisfies the following property:
- For all $x,y\in A$, $xf(y)+yf(x)\in A$ and $f(xf(y)+yf(x))=xf(y)+yf(x)$.
The following lemma gives one way to construct many such functions.
Lemma: Let $A\subseteq\mathbb{R}$ with $0\in A$, let $f:A\to\mathbb{R}$ be good, let $a\in \mathbb{R}\setminus A$, and let $b\in\mathbb{R}$ be transcendental over the field generated by $A\cup f(A)\cup\{a\}$. Then there exists $B\subseteq\mathbb{R}$ such that $A\cup\{a\}\subseteq B$ and $|B|\leq |A|+\aleph_0$ and a good function $g:B\to\mathbb{R}$ which extends $f$ such that $g(a)=b$.
Proof: Let $B_0=\{2ab\}\cup\{af(x)+bx:x\in A\}$. Let $B_1$ be the closure of the set $B_0$ under the following operations:
Let $K$ be the subfield of $\mathbb{R}$ generated by $A\cup f(A)\cup\{a\}$; then clearly $B_1\subseteq K[b]$ (so in particular $|B_1|\leq |A|+\aleph_0$). Moreover, $B_1$ contains no nonzero elements of $K$, since $B_0$ contains no nonzero elements of $K$ and $K[b]\setminus K$ is closed under all of these operations except when we multiply by $0$.
Now let $B=B_1\cup A\cup\{a\}$ and define $g:B\to\mathbb{R}$ by $g(x)=f(x)$ for $x\in A$, $g(a)=b$, and $g(x)=x$ if $x\in B_1$. Note that $g$ is well-defined, since $B_1\cap A=\{0\}$ and we must already have $f(0)=0$ since $f$ is good.
I claim that $g$ is good; to prove this, suppose $x,y\in B$. If $x,y\in A$, then we are done since $f$ is good. In all other cases, we will show that $xg(y)+yg(x)\in B_1$ and so $g(xg(y)+yg(x))=xg(y)+yg(x)$. Here are all the cases (with cases which are equivalent to these by swapping $x$ and $y$ omitted):
- If $x\in A$ and $y=a$, then $xg(y)+yg(x)=xb+af(x)\in B_0$.
- If $x\in A$ and $y\in B_1$, then $xg(y)+yg(x)=xy+yf(x)=y(x+f(x))\in B_1$ since $B_1$ is closed under multiplication by $x+f(x)$.
- If $x=y=a$, then $xg(y)+yg(x)=2ab\in B_0$.
- If $x=a$ and $y\in B_1$, then $xg(y)+yg(x)=ay+yb=y(a+b)\in B_1$ since $B_1$ is closed under multiplication by $a+b$.
- If $x,y\in B_1$, then $xg(y)+yg(x)=xy+yx=2xy\in B_1$ since $B_1$ is closed under $(x,y)\mapsto 2xy$.
Now here's how you can use the lemma to construct good functions on all of $\mathbb{R}$. Fix an enumeration $(r_\alpha)_{\alpha<\mathfrak{c}}$ of the real numbers. We construct our function $f$ by transfinite recursion as a limit of good partial functions $f_\alpha:A_\alpha\to\mathbb{R}$, starting with $A_0=\{0\}$ and $f_0:A_0\to\mathbb{R}$ given by $f_0(0)=0$. At limit steps, we just take unions. At successor steps, we use the Lemma to extend $f_\alpha$ to a larger domain. More precisely, let $a$ be the first number in our enumeration of the reals which is not in $A_\alpha$, and let $b$ be some real number that is transcendental over the field generated by $A_\alpha\cup f(A_\alpha)\cup\{a\}$. (We can do this since by induction, $|A_\alpha|\leq |\alpha|+\aleph_0<\mathfrak{c}$.) We then let $A_{\alpha+1}$ and $f_{\alpha+1}$ be $B$ and $g$ as given by the lemma.
In the end, this gives a function $f=\bigcup_{\alpha<\mathfrak{c}} f_\alpha$ which is defined on all of $\mathbb{R}$ and good, so it is a solution to your problem. Moreover, by varying the choice of $b$ used in each successor step, we can get many different such functions ($2^{\mathfrak{c}}$ of them, though this takes a bit of work to prove).