The algorithm is based on the following observation. An integer $b>a$ can be written as $b=a + k$ with a and k integers. So if we want to find a sum of 2 squares of an integer N, we start by writing $N= a^2 + b^2$. Then we transform this equation into a useful one by rewriting it as $$N= a^2 + b^2= a^2 + (a+k)^2$$ This equation is just a quadratic in $a$. Namely $$2a^2 +2ak +k^2-N=0$$ Its discriminant is given by $$d=2N-k^2=s^2$$ Basically, we want to find the values of k that make the discriminant d a square. The fact that there is a minus sign before $k^2$ guarantees that the number of steps to find a solution is finite.
Let's take the example of $N=41$ to see how the method works in practice. We are looking for values of $k$ that make $d=82-k^2$ a square. We can see that $k=1$, the first value of $k$ makes $d$ a square with $d=9^2$. And this value of $d$ in turn provides us with two values of $a$, $a=2$ and $a=-5$.
Do we need to check every single value of $k$ to see if it makes $d$ a square? The answer is no. 82 is of the form $4m+2$ and squares are known to be of the form $4m+1$ or $4m$. We can rewrite $82-k^2=s^2$ as $82=k^2+s^2$ and the only possible combinations of last digits of the squares $k$ and $s$ that can add up to 2 in 82 are $(6,6)$ and $(1,1)$. However the $(6,6)$ can be dropped because squares that have a last digit of 6 are of the form $4m$ and therefore will not produce the 2 in 82. So that leaves only the $(1,1)$ combination of last digit of $k$ and $s$.
We see that this method does not require the factors of N when N is a composite number. We also see that it is probably the simplest method and the easiest to understand. The information on which integers can be put into the form $N=a^2 + b^2$ is known and can be found elsewhere (wikipedia).
Is this method the simplest?