Lol, again, my standard answer, "depends on the species", at least to some extent. Many arboreal/semi arboreal species will do it regularly, just to see whats going on. Even more commonly terrestrial species will do it occasionally.
As far as the mental picture of a snake "standing up" to defend itself against a perceived threat, maybe a king cobra is a classic example, it isn't really that common, at least not to that extent. Most snakes will obviously raise their heads in order to strike if needed, but most will stay lower to the ground, coiled, with less body exposed. The only species I keep that ever displays this at all is my olive python, Liasis olivaceus.
But overall, some species do it as a defensive posture, some do it as a means of surveying an area, some will do it to reach an area otherwise inaccessible.