Scale and size, Tubagirl. You can walk up a wall if provided with crevasses and projections equal in scale to your fingers and toes as the ones an ant uses. I would suspect some aspect of it has to do with the ratio of weight to strength of an ant, also, but I’ll leave discussion of that to those with info.
Also, I think this belongs in General Questions. Where IS that moderator…
Ants can climb walls for two reasons: (1) the ‘smooth’ walls are not all that smooth because they have microscopic bumps and crevasses. (2) the ants have little hooks on their feet designed to grip in and on these little irregularities.
(This was not straightforward look-up. The EB article on ants does not discuss their feet. I did a web search on “ant feet” and on one hit found a reference to arolia. I came back to EB and looked up arolia. There was no article on it, but the search did turn up the reference in the section on insect thorax.)
The others answered your main question, but I’ll just note that gravity doesn’t work any differently for ants than for us. It’s just that the adhesive/hooks on the ants’ legs certainly don’t have to support much weight.
Also, there’s some structural advantage to being tiny. The amount of muscle required to move an ant’s body vertically is pretty small, and the stress on the wall’s structure is very little. In fact, due to gravitational effects, I’m not at all sure a creature structurally identical to an ant, but weighing 50 pounds or more, would be able to scale walls without adding a lot of muscle mass. And I know such a critter would be hard on the plaster walls in my house!