How do volume shaders interact with light?
Some shaders determine what happens when light rays are reflected or emitted  by the surface of an object.

But what happens to the light when it goes through, or inside the object, is determined by the volume

In blender, volume can be used as part of the material on objects, or for the world.


There are many uses for volume shaders, like creating clouds, smoke or a hazy atmosphere and volumetric lighting or to simulate liquids or glass.
The main concepts to understand are Scattering, Density, Anisotropy and Absorption.
Scattering
The reason we see rays of lights on a dusty, or hazy environment is because there are suspended particles on the air that reflect the light.

Photons are scattered when they collide with particles. When light travels through a volume in a certain direction, photons are deflected in other directions when they collide with particles. This phenomenon is called scattering.  How frequently light is scattered by particles both depends of the particles properties (mainly their size) and their density in the volume (how many particles/molecules are in one unit of volume)

(https://www.scratchapixel.com/lessons/procedural-generation-virtual-worlds/simulating-sky/simulating-colors-of-the-sky)
Density
Determines how thick the volume appears to be. More particles (or a denser environment) will result in less light travelling through, and more light being scattered .
Anisotropy
Controls the look of the scatter effect depending on the direction of the light passing through it.

Positive values let the ray scatter in the direction it is traveling, while negative values cause the ray to scatter opposite of its travel direction.



For positive values, rays mostly get scattered along the direction of the ray that entered the volume. Negative values mostly scatter into the opposite direction. Anisotropy of 0.0 (center) will result in random scatter directions. Depending on the density, rays might not get scattered at all.

(from: https://www.blenderdiplom.com/en/tutorials/all-tutorials/582-cycles-volume-scatter.html)
Absorption
Light is absorbed as it passes through the volume, a black liquid like black ink will absorb all of the light passing through it, for example. A glass or liquid can act as a color filter by absorbing some colors and letting others go through unfiltered.

How to make glass clear at overlapping point

Practical examples:
Light passing through an object with Volume scatter (suspended particles, like smoke, haze, dust, smoke)
Atmospheric lighting in cycles

or light being emitted inside a volume

Fire and smoke:


How to create fire materials using the new Principled Volume node that visually look the same as the &quot;old method&quot; of fire materials?
Volume absorption makes the object transparent but absorbs light which passes through it. It can be used whenever you need a material which absorbs light, such as water or colored glass.
Here's an example, the liquid has no color, but the volume absorption node makes the light that goes through it be red:


fluid in a glass

Further reading:
https://www.scratchapixel.com/lessons/advanced-rendering/volume-rendering-for-artists