How to factor$ x^2+2xy+y^2 $ I know the formula $x^2 + 2xy + y^2 = (x + y)^2$ by heart and in order to understand it better I am trying to solve the formula myself; however, I don't understand how step 4 is derived from step 3.
$$x^2+2xy+y^2\qquad1$$
$$x^2+xy+xy+y^2\qquad2$$
$$x(x+y) + y(x+y) \qquad3$$
$$(x+y)(x+y) \qquad 4$$
How does one get from step 3 to step 4? I don't know how to do that process.

It's simply a common binomial factor. Common factors don't have to be just a variable or a number; they can be any written expression. Suggest that you find a section in a textbook labelled "factor by grouping" and practice several problems there.
Obviously $xb + yb = b(x + y)$. If you see that, your problem is identical with the replacement $b = (x + y)$. 
As a side issue, derivations like this are generally easier to accomplish going from complicated-to-simplified form. Start with $(x + y)^2$ and simplify it; you'll probably find it more straightforward (just expand and FOIL).
