According to the question mentioned here, it seems that there is no function $f(x)$ such that the functional equation
$$f(x+y)=f(x)+f(y)-(xy-1)^2$$
can hold. Motivated by this question, I found it interesting to somehow extend the question.
What conditions are required for a given function $g(x)$ such that there exists a function $f(x)$ that can satisfy the following equality $$f(x+y)=f(x)+f(y)+g(xy)$$ where $f(x)$ and $g(x)$ are real valued functions of real variable.
Any hint or help is appreciated. :)
If $f$ is not differentiable, we still have $f((x+y)+z)=f(x+(y+z))$, from which follows
$$g(xy)+g(xz+yz)=g(xy+xz)+g(yz)\tag{1}$$
By change of variables
$$x=\sqrt{\frac{ab}{c}}, \quad y=\sqrt{\frac{ca}{b}}, \quad z=\sqrt{\frac{bc}{a}}\tag{2}$$
this becomes
$$g(a)+g(b+c)=g(a+b)+g(c)\tag{3}$$
whenever $abc>0$.
By change of variables $(a,b,c)\to(a+b,-b,b+c)$ we can also move $-b$ across so it holds for all $abc\neq0$. Then
$$g(a+b)+g(b-b)=g(a)+g(b)\tag{4}$$
so $h(x)=g(x)-g(0)$ satisfies $$h(a+b)=h(a)+h(b)\tag{5}$$ This has the well-known solutions $h(x)=kx$, and some very discontinuous ones.