Is there a general method for expressing $x^2 - 2y^2$ as a sum of 2 squares when we know for some reason that it must be possible?
I was solving a problem for which once you get to the end, you're asked to express the answer as a sum of 2 squares. I got to $169^2 - 2 \cdot 80^2$ and couldn't continue. Instead, I expanded it to $p = 15761,$ found that $p$ is prime, and used the usual quadratic residue algorithm to express $p$ as a sum of squares.
With the answer in mind, we can use the power of hindsight bias to notice that $169^2 - 120^2$ is a perfect square. This leads to the general observation that if $y$ is even and $x^2 - (3y/2)^2 = z^2,$ then $x^2 - 2y^2 = z^2 + (y/2)^2.$
But what if we don't have hindsight bias and $x, y$ are much larger? Is there a general method for spotting what to subtract and add so that we get a sum of squares?