How do I install the trap for a standard bathroom sink?
There are many ways to assemble the new drain. Assuming the 1 1/2" pipe is threaded:

1) screw an 1 1/2" ABS female adapter to the pipe.

2) using a short piece of 1 1/2" ABS pipe, glue an 1 1/2" ABS slip X slip elbow on, so it ends up facing out towards where the new trap will be.

3) glue a piece of 1 1/2" ABS pipe of appropriate length into the elbow (longer is better, you will be cutting this back later). This will be the pipe that protrudes through the drywall.

4) install drywall.

5) buy an 1 1/2" ABS P-Trap assembly, the "slip-joint" type (it will come in a complete kit).

6) install bathroom sink. 

7) pre-assemble and dry fit everything, measure 3 times, cut once!

8) cut 1 1/2" abs pipe back and glue on the 1/1/2" ABS male adapter that came with the P-Trap kit.

9) assemble P-trap and adjust to fit. Your sink drain pipe (tailpiece) may be 1 1/4" but the P-trap kit comes with reducing nuts/washers to accommodate.

10) have rewarding beer for job well done. No leaks = no worries.