Generally, when a substance is at > 0 K (0 Kelvin or -273°C) the atoms/molecules making up that substance possess kinetic energy, which means that each atom/molecule are [almost] constantly moving. If that atom/molecule is in a vacuum, it would move in [almost] a straight line. However, in the ordinary matter that we encounter everyday, atoms/molecules exist in macroscopic phases which are composed of a humongous number of particles. Which means that each particle experiences frequent collisions with neighbouring particles, making the trajectory of each particle to appear zig-zag like.
The higher the temperature in the vicinity of an atom/molecule, the higher the kinetic energy of the particle, and the faster that particle's motion becomes.
Also, depending on the properties of the atoms/molecules in the substance, each atom/molecule experiences electrostatic forces (either attractive or repulsive) exerted by neighboring atoms/molecules.
At the interface between a liquid and a gas (e.g., water in a tumbler sitting on a table in a room at sea level), the surface of the liquid is constantly being bombarded by gaseous particles that have much higher kinetic energies than the molecules of the water in the tumbler. This bombardment imparts enough kinetic energy to some of the water molecules at the surface. Some of the bombarded molecules gain enough kinetic energy to enable them to leave the water surface to become gaseous water molecules. Some of the bombarding particles (oxygen molecules, nitrogen molecules, water vapour molecules, etc.) from the air lose enough kinetic energy so that they become stuck into the liquid surface. At equilibrium (maximum humidity saturation of the air in the room), the number of water molecules leaving the liquid surface is equal to the number of molecules entering the liquid surface.
It is the net result of factors 2, 3 and 4 that determines the phase of a substance. For example, substances like water, which are composed mainly of polar molecules (molecules possessing an asymmetrical distribution of charge around it, making it behave like a bipolar/tripolar/multipolar magnet), have relatively high melting and boiling points. Below the melting point, the molecules exist in a [3D] crystalline lattice. Each molecule are in constant motion but are at the same time held together by electrostatic forces (hydrogen bonds). Since in a solid, the kinetic energy or velocity of each molecule is not high/fast enough, those particles cannot overcome/escape from the electrostatic attraction exerted by their immediate neighbours. Therefore, the molecules stay stuck in the crystal lattice, exhibiting their kinetic energy as vibrational motion.
When the melting point is reached, the kinetic energy of the molecules starts to overcome the electrostatic attraction from neighbouring particles, allowing them to move away from their neighbours. This is the liquid state, in which the kinetic energy of the particles are enough to prevent the particles from being stuck in one place, allowing them to move about, making the phase fluid; however, the kinetic energies are not enough to allow the particles to move farther away from each other. In the liquid state, the distances between neighbouring particles are almost the same as that in a solid.
For a liquid to become a gas, two factors must be overcome: (a) the intermoleculer forces in the liquid, and (b) the pressure above the liquid surface. At the boiling point, the kinetic energies of the particles become high enough to overcome (a) and (b) to enable the particles to move farther away from each other, and we get a gaseous phase.
Factor (a) is overcome, for example, by heating the liquid in the container.
You can appreciate the effect of factor (b) when you go mountain-climbing (5000 feet or higher). Take a thermometer with you to the mountain top. You will observe that water at high altitudes boil at temperatures lower than 212°F (100°C).
Another way to experience the effect of factor (b) is through the following experiment: Get a 50-mL (1 to 2-oz) syringe, remove the needle, draw water to about 25% capacity of the syringe barrel, plug the inlet with your index finger, then with your other hand, pull the plunger until it is almost at its maximum position. You should see the water in the syringe boil without the application of heat.
This seems to be a simple question but a full answer can be appreciated only with some knowledge of statistical thermodynamics.
BTW, the pressure of a gas is the macroscopic result of a humongous number of particles impinging upon a surface (the diaphragm of a barometer, the surface of a manometer liquid, the walls of a container, etc.).