Solution by benjaminchew13.
Let P(x,y) be the given assertion.
P(1,y):f(f(y)f(1)+f(1))=y+1, so f is bijective.
P(0,0):f(f(0)2+f(0))=0.
P(0,y):f(f(0)f(y)+f(0))=0.
So f(0)f(y)=f(0)2 for all y. Since f is bijective, taking f(y)=f(0) gives f(0)=0.
P(x,0):f(f(x2))=x2.
P(x,−x):f(x2)=−f(x)f(−x).
f(1)=f(0), so P(1,−1):f(−1)=−1.
P(−1,−y):f(f(1)−f(−y))=y+1.
P(1,y):f(f(y)f(1)+f(1))=y+1.
So −f(y)f(1)=f(−y).
f(y)=−f(−y)f(1)=f(y)f(1)2.
Since f(1)=f(−1)=−1, we have f(1)=1.
So f(−y)=−f(y), and so f is odd.
But since f(f(x))=x for all positive x, we have that this holds for negative x, and so f(f(x))=x for all x.
P(1,f(y)):f(y+1)=f(y)+1.
f(x2)=−f(x)f(−x)=f(x)2, so we have P(x,y):f(f(x)(f(y)+f(x)))=x2+xy.
x→f(x),y→f(y) gives f(x2+xy)=f(x)2+f(x)f(y).
Let this be the new P(x,y) (because it is equivalent to the original equation as f(f(x))=x).
P(x,x1):f(x1)=f(x)1 for all x=0.
P(−x−y,y):f(x)2+f(x)f(y)=f(−(x+y))2+f(−(x+y))f(y).
If x=−x−y, then we have f(−(x+y))=−(f(x)+f(y))⟹f(x+y)=f(x)+f(y).
If x=−x−y, then we have y=−2x, then since we have P(2,y):f(2y)=2f(y) as f(1)=1⟹f(2)=2, we have that f(x+y)=f(−x)=−f(x)=f(x)+(−2f(x))=f(x)+f(−2x)=f(x)+f(y).
So we have that f is additive for both cases.
So f is additive.
Then f(x)2+f(x)f(y)=f(x)2+f(xy), so f is multiplicative.
Since f is both additive and multiplicative, we have that f(x)≡0 and f(x)≡x as the solutions.
But obviously f(x)≡0 doesn’t work, and so f(x)≡x is the only solution, which is true as the plugging into the original equations give x2+xy=x2+xy.