How do I properly nail two 2x4's at a 90 degree angle?
Nails are generally put in at 90 degrees to the wood (i.e. straight in), unless you are "toe-nailing". (see picture)



It all really depends on the application. As opposed to just nailing straight in, like if you were nailing together a built-up beam (face nailing) - Toe nailing the wood is usually not bearing much or any weight on the nails, they are holding wood in place.



If the wood is going to be horizontal and bearing weight, face-nailing parallel members is good. However, for perpendicular members, I would want structural hardware in end nailed or toe-nailed pieces (joist hangers, angle brackets, etc.). 


  I've read though, that the pros like nail at a 45 degree angle, so that the nail doesn't go through the end piece of the horizontal 2x4, but through the top part. Is this correct? I don't like having the end part of the nail stick out.. even if I hammer the sharp point towards the wood.


If the nail sticks out the other end, you should use shorter nails.