Find all pairs of functions $(f,g)$, $\forall x, y \in \mathbb{R}, f(x+g(y))=x f(y) - y f(x) + g(x)$

Posting a modified answer (combined from CanVQ and efang’s posts) from user119228's comment for the sake of preservation.

Consider $f(0)$, which either equals $0$ or doesn’t. We now consider these two cases.

Case 1: $f(0)=0$.

Taking $y=0$ in $(1),$ we get $$f(x+b)=g(x),\quad \forall x \in \mathbb R. \quad (3)$$ From this, we deduce that $g({-b})=0.$ Now, replacing $y=-b$ in $(1),$ we have $$f(x)=x\cdot f({-b})+b\cdot f(x)+g(x),\quad \forall x \in \mathbb R. \quad (4)$$ Taking $x=-b$ in $(4),$ we get $f({-b})=g({-b})=0$ and hence, the equality $(4)$ can be rewritten as $$(1-b)\cdot f(x)=g(x),\quad \forall x \in \mathbb R. \quad (5)$$ Taking $x=0$ in $(5),$ we get $b=g(0)=0.$ Thus, the identities $(2)$ and $(5)$ can be written as $$f\big(g(x)\big)=0,\quad \forall x \in \mathbb R\quad (6)$$ and $$f(x)=g(x),\quad \forall x \in \mathbb R. \quad (7)$$ From $(6)$ and $(7),$ we get $g\big(g(x)\big)=0,\, \forall x \in \mathbb R.$ Now, replacing $y$ by $g(x)$ in $(1),$ we can easily deduce that $f(x)=g(x)=0,\, \forall x \in \mathbb R.$ These functions satisfy our condition.

Case 2: $f(0)\neq 0$ which implies $$f(g(y)) = -y\cdot f(0) + g(0)\tag{8}$$

We first prove that $f$ and $g$ are both bijective. Clearly $f \circ g$ is a bijective function as it's linear. Thus we can immediately conclude from it's injectivity that $g$ is injective and from it's surjectivity that $f$ is surjective. For any $c \in \mathbb{R}$ note that if $f(c) = a$ we have $f(c) = a = \frac{a-g(0)}{f(0)} * f(0) + g(0) = f(g(\frac{g(0)-a}{f(0)}))$ and since $f(0)$ is non-zero we have that there necessarily exists some real number a satisfying $g(a) = c$ for all real c proving surjectivity.

Now, we had $a,b \in \mathbb{R}$ such that $f(a) = f(b) = c$. Then, we know there exist real m and n such that $g(m) = a$ and $g(n) = b$ Then we would have $f(g(m)) = f(a) = -m*f(0) + g(0)$ and $f(g(n)) = f(b) = -n*f(0)+g(0)$ Thus we have $m=n$ and $a=b$ so f is injective. Thus both $f$ and $g$ are bijective.

Now this means there exists a unique value $a$ such that $g(a) = 0$. Plug in $x=y=a$ into the original equation to get $$f(a) = g(a) = 0\tag{9}$$ Now, plug in just $y=a$ and use the result from $(9)$ to obtain $f(x) = -a*f(x) + g(x)$ or $$(a+1)f(x) = g(x)\tag{10}$$

Plugging $(10)$ into $(8)$ reveals $$f((a+1)f(x)) = -x*f(0)+(a+1)f(0)$$ Now notice that when $x=a+1$ we have that $f((a+1)f(a+1)) = 0$. Thus $f(a+1) = \frac{a}{a+1}$ and thus also $$g(a+1) = a\tag{11}$$

Now, plug $(10)$ back into the original equation and we get $f(x+(a+1)f(y)) = xf(y) - yf(x)+(a+1)f(x)$. Plug in $y=a+1$ and use $(11)$ and we get: $f(x+a) = \frac{xa}{a+1}$ or $$f(x) = \frac{(x-a)a}{a+1}$$ and thus from $(10)$ $$g(x) = (x-a)a$$ for some real constant $a$ which completes the problem.