Well, because lizards have these microscopic grooves in their skin under their tiny feet that hold on to surfaces, unlike suction cups however. The ridges fit into the surface, gripping to just about anything. That's why they can hold on like they do and even do so for a while after they are dead. We have so many lizards here. Gravity pulls but their grip is just stronger. That's one super power I wish I had.
If they are heavy enough, they will fall. But if they apply enough force to grip the ceiling with their little foot barbs, and that force has greater magnitude than the force of gravity acting downward on them, then they will stay on the ceiling. The more grips the ceiling has and the bigger the lizards' toenails or barbs, the better they can stay up there.
You can experiment yourself by covering your ceiling with velcro and making yourself a velcro suit to adhere to it. Depending on your weight, you may have no trouble staying up there.