It depends on where you live and the codes, such as city or home owner association, governing your fence. In most cases, fences that are viewable from a street must be constructed with the face towards the street. The face of a fence is the side where you can't see the frame. Fences facing the front of the house would meet this criteria as well as a fence on a corner lot.
If you are unsure of the restrictions for your area, check with your city's code enforcement agency and your home owners association. Ultimately it's your responsibility to make sure your fence is in compliance.
Security is another reason to be concerned with which way a fence faces. A fence built with the face towards the house may look prettier, but it allows children and anyone else wishing to gain access to your yard, easy climbing access.
Sometimes obstacles in a yard will dictate which way a fence needs to face. A shed or row of shrubbery pressed up against a fence line will force the face to be built away from the obstruction due to the worker needing room to nail the pickets to the frame.