You level when enough skill increases occur. You choose when to level; it is not automatic (FO3), nor do you need to sleep (Oblivion). You choose to increase health, magicka, or stamina, plus you gain 1 perk point. You can assign the perk point then, or you can save it and accumulate points to assign later. However, remember that once you choose to level up, you have to do all the levels you have accumulated up to then (not all perk points, though, just all levels).