So the problem is as follows:
Consider $$f\big(xy + f(y)\big) = y\,f(x).$$ Find the value of $f(y)$.
My friend showed me that $ \ (*) \ \ f(y) = 1 - y$.
Proof: By setting $x = 1$, we obtain $$f\big(y + f(y)\big) = y\,f(1).\tag1$$ Now, by setting $y=1$, we obtain $$\begin{align} f\big(x + f(1)\big) &= f(x) \\ \Leftrightarrow x &= x + f(1) \\ \Leftrightarrow f(1) &= 0.\end{align}$$ Consequently, equation $(1)$ becomes $$\begin{align} f\big(y + f(y)\big) &= 0 = f(1) \\ \Leftrightarrow 1 &= y + f(y) \\ \Leftrightarrow f(y) &= 1 - y \\ \\ \therefore \ f(xy + 1 - y) &= y\,f(x).\tag*{$\Box$}\end{align}$$ I found this solution to the problem very elegant, but I wondered to myself, How do you know what method to use in problems like this? In addition to that, is there another way of showing the truth of $(*)$?
Thank you in advance.
First of all, $f\equiv0$ is a trivial solution, too. Let's show that every non-trivial solution of $$f\big(xy + f(y)\big) = y\,f(x)\tag1$$ is one-to-one, i.e. $$f(u)=f(v)\Leftrightarrow u=v\tag2$$ (and then, the reasoning above is correct, giving $f(y)=1-y$). For that, we set $x=0$ in (1), giving $$f(f(y))=y\,f(0)\tag3.$$ If $f(0)\neq0$, we're done, because $f(u)=f(v)$ implies $f(f(u))=f(f(v))$, i.e. $u\,f(0)=v\,f(0)$.
So we have to investigate the remaining case $f(0)=0$. Then, $f(f(y))=0$ for all $y$, implying $f(y)=0$ for $y\in f(\mathbb{R})$. If $f$ is not the trivial solution, there is a value $x_0$ with $f(x_0)\neq0$, and replacing $x$ by $x_0$ and $y$ by $y/f(x_0)$ in (1), we get $$y=f\big(x_0y/f(x_0) + f(y/f(x_0))\big),$$ i.e. $f(\mathbb{R})=\mathbb{R}$ and thus $f\equiv0$, a contradiction.