You might be picturing the whole thing wrong. The walls are not smooth in the real world. Normal reaction has a vertical component, and the weight of the snake is balanced by this.
Snake locomotion
Let me first say that I am not an expert on snakes, so please do your own research before citing or sharing this answer.
Due to the lack of legs, snakes have to employ a variety of methods to move around. Each of these methods have their own advantages, and snakes choose between them depending on the topography and texture of surfaces they are on. One of those methods is called Lateral undulation, which might be used to climb though rough walls.
In this mode, the snake climbs the wall by hanging on to it, either using its body as a whole or using its scales to cling on surface irregularities on the wall, like a mountaineer climbs using an axe.
This study shows that snakes can actuate their belly scales to actively generate friction for moving forward.
This is an animation I made using Scratch, which might give an idea of how they can move in this position. Check it out!
However, as this study points out, Lateral undulation is one of the slowest mode of locomotion for snakes, and they rarely choose to perform this. If the surface is rough enough or if there is a groove, a snake finds locations where it can latch on to, and pushes its way through (Concertina movement, B).
For climbing poles and trees, they mostly use concertina movements.
Conclusion
In conclusion, for all these methods to work, you need irregularities in the surface, which brings us to the take home message of this discussion. Snakes cannot climb smooth walls. So if you need to keep snakes from climbing into your house, put smooth ceramic tiles/wallpapers on the walls.
References:
- Snakes move their scales to increase friction - Biotribology
- Why arboreal snakes should not be cylindrical: body shape, incline and surface roughness have interactive effects on locomotion. - Journal of Experimental Biology
- Snakes' scales propel them up tree trunks - NBC news
- Snake locomotion - Wikipedia
- Generating Snake Robot Concertina Locomotion Using a New Dynamic Curve - International Journal of Modeling and Optimization