I will present a new formalism, based on the so-called Conditional Luminosity Function (CLF), to link galaxies to their dark matter haloes. I show how this formalism can be used to determine the average mass-to-light ratio as function of halo mass, which in turn puts stringent constraints on galaxy formation theory. I also show how the CLF formalism can be used to construct detailed mock galaxy redshift surveys. I will present a number of applications based on these mock surveys, including large scale structure analysis, the kinematics of satellite galaxies, and the statistical properties of galaxy groups.