This link (Wikipedia article: Euler's factorization method) has what you're looking for.
We know from a theorem that if an odd integer N equals a^2+b^2 = c^2+d^2 cannot be a prime. Show that the following process will find a factorization. Assume we label them so all a,b,c,d positive, a,c odd, b,d even and a is not equal to c.
1) Set u=gcd(a-c,d-b) and w=gcd(a+c,d+b). Prove that a-c=lu and d-b=mu and a+c=mw and d+b=lw for some l and m.
2) Now show that N = [(u/2)^2 + (w/2)^2]*[m^2 + l^2].