How does holding a glass prevent it from falling? When I hold a glass of water,
$\hspace{1.5cm}$,
I am applying a force horizontally, but its weight acts downwards. Should it not fall?
How do you describe the equilibrium?
 A: At first I thought this question wasn't that good. But the more I thought about it, I realized friction might not be that intuitive. I'll try to explain your question as I've understood it by using a simplified model.
Idealized Model (Frictionless)
If we have a glass cylinder with perfectly flat, smooth, vertical, and frictionless sides and we have two perfectly flat, smooth, vertical, and frictionless plates that attempt to exert a normal force on the glass, we can understand that the glass will not be held in place as there is no way to transfer an opposing force to the force of gravity.
Therefore, this idealized model cannot explain how your problem works. We know that friction is a force, and clearly it is required to explain this behavior. So what is friction and how does it work?

Friction Model
Well in the real world, objects are not perfectly flat or perfectly smooth (and even if they were you get other problems like cold welding as I'll explain later). In the real world, the surface of each object has imperfections and is going to look like peaks, valleys, canyons, ridges, holes, etc. That means when two surfaces come into contact there is "locking" between the surfaces. Even if you think of this down to the atomic level, some atoms will be higher than others on the surface. You can think of that egg crate foam and how two pieces will interact if you place the pointy surfaces against each other. There are other effects at this scale and all of these microscopic interactions result in the force we simplify and call friction.


Now the extreme case of surface interaction, say you have two very clean and very smooth pieces of metal, these two metals can actually bond together in what is known as cold welding. The atoms of each piece join together to make the piece whole (I'm simplifying here). What I'm trying to illustrate, is that at the atomic level of friction, atoms are and can be exchanged between the two surfaces. So that friction force is also a result of inter-atomic bonds. It is a complex phenomenon.
Conclusion
The atoms / surface of your fingers are not perfectly smooth, and they interact with the glass surface providing the necessary force to counter gravity. Friction is generated all long the interface and produces a resultant friction force equivalent in magnitude to the gravitational force. The friction is produced from surface roughness, interatomic, intermolecular, and electrostatic forces/interactions.
A: I'm not sure exactly what you're asking, but you've used the friction tag, so you realize friction is involved.
Think about how the usual "block on a plane" friction problems work: Gravity exerts a force downward (normal to the friction surface), but if you try to move the block across the plane, friction exerts a force parallel to the plane surface to oppose you.
In this case, instead of gravity providing the normal force, the grip of your fingers does. And instead of "you" trying to push the block, gravity is trying to move the glass parallel to the surface of your fingers. And friction causes an opposing force parallel to the surface of your fingers against the glass.
A: In addition to the answer of @The Photon, consider that for many glasses, the sides of the glass taper inward towards the bottom of the glass.
For such a glass, friction is not needed.  Simply holding your fingers a fixed distance apart will exert a force on the wall of the glass with an upward component, stopping the glass from continuing downward.
Of course, in the absence of friction, you run the risk of squeezing the tapered glass too hard, and squirting it upward...
A: 
"I am applying a force horizontally ..."

Absolutely, totally wrong.
In the photos, you are applying an upwards force to the mass.  Just as you would expect.
The only purpose of the finger pinch force is to increase static friction.  Note that if you simply dry the glass and glue the glass to your fingers (or use, say, gloves with velcro and velcro on the glass) you of course can completely stop the "pinching" force.  For example, very simply if the glass is dry, the horizontal "pinching" force need be much less - and if the glass is sticky rubber (like a reusable Starbucks mug) the horizontal "pinching" force is almost nothing.
The method of holding the glass (friction, pinching, velcro, whatever) is totally irrelevant.
You are right now in the photo applying an upwards force to the mass. - note that, extremely simply, if you slowly decrease the upwards force you are applying, the glass will, of course, move down towards the floor.  Similarly if you, say, stand on a chair as in the photo, and jump off the chair, the glass (and you, and your hand) will of course move straight down.  No matter how much pinching force you apply, the pinching force will obviously make utterly no difference to it moving down.

One small detail.  As any video game programmer will instantly observe, actually purely regarding the pinching force:  you absolutely are not applying a horizontal force.  The various forces from your fingers/thumb cancel out as seen from overhead.  The force in the X axis is, supplied by "you", is of course precisely zero. (If it was not zero, you would be ... throwing the glass! it would be moving in the direction of that horizontal force!  You absolutely are not applying a horizontal force.)

To help with the embarrassing downvoters, here's a very basic explantion:

and here's all horizontal forces on the glass:

