It is not easy business indeed. There are numerous papers on the subject. The original paper from which it all began is this:
H. Hoppe, T. DeRose, T. Duchamp, J. McDonald and W. Stuetzle, "Suface reconstruction from unorganized points," in SIGGRAPH, 1992. The method itself is realized in VCG (Meshlab) and PCL libraries.
One of the more recent papers: J. Liu, J. Cao, X. Liu, J. Wang, X. Wang and X. Shi, "Mendable consistent orientation of point clouds," Computer-Aided Design, vol. 55, pp. 26-36, 2014 http://jjcao.weebly.com/uploads/4/5/3/4/4534726/cad14.pdf
The authors of the paper provide a Matlab code: http://jjcao-orientation.googlecode.com/svn/trunk/Code/ The code is much slower than the original Hoppe algorithm but gives much nicer results, especially in hard cases when the mesh contains sharp corners and non-smooth edges.
Also, a good review of general ideas is this one: http://vmv09.tu-bs.de/downloads/papers/koe09.pdf
If you know that the point cloud was obtained from a particular point (say, from a Kinect or a laser scanner), you can make the direction of the normals to be consistent with the viewpoint by flipping them if needed. But if you deal with a model of an entire object which, then some normal propagation algorithm is required.