You could hang 40 kg from a gecko and it wouldn't fall off the ceiling but ...
Geckos have very hairy feet, and we mean VERY hairy here! The soles of their feet are covered in teeny tiny hairs which end in even tinier structures called spatulae. These microscopic spatulae are so small that a usually insignificant force, called the van der Waals force, becomes important.
Even though a molecule might be electrically neutral overall, an uneven distribution of the electrons within it can create a local net charge, meaning it can attract other similarly unbalanced molecules. The van der Waals force between molecules is miniscule and even one individual hair doesn't have much sticking power, but millions of hairs acting together can produce some serious adhesion.
The challenge with sticking so well is how do you unstick yourself? Geckos solve this by having toes that bend in the opposite direction to ours which means that they are able to peel their feet off a surface, a bit like peeling off a sticky plaster from one corner.
40 kg is really heavy
So how sticky are geckos' feet?
By looking at the total van der Waals forces, researchers can predict that one square centimetre of hairy gecko foot would be able to hold 1 kg. This means that a large gecko, using all its feet at once, would be able to hold 40 kg. Since a large gecko only weighs about 150 g, this is pretty impressive.
Unfortunately, if you really tried to hang 40 kg from a gecko, it's likely that it wouldn't survive since its muscles and skeleton aren't designed to take such a large force. But it would still be stuck to the ceiling.