The second moment theory of families of L-functions