Basically for me, painting in layers is just what it sounds like.
I paint a section of a painting, then after it's dry, paint on it again, and again. It's a classical approach that has been done for a long time and taught by many schools of art (or at least it used to be). Famous painters, like Rembrandt, Titian and Rubens painted this way.
It's a different approach than painting "alla prima" (basically one layer, painted in one sitting). For me, painting in layers is a more leisurely paced technique that allows me to slowly build up the painting, without being rushed. This way I can build up colors and textures, creating a rich painting (and every brush stroke doesn't have to be "perfect.")
On the other hand, alla prima is much more about speed. I do this when I paint outdoors, en plein air, where how fast you paint is important. - the approaches are very different.
How many layers? (Actually, that's not really the right question to ask.) I also see some who declare there's a specific number of layers if you're painting in layers. (That would not be my answer.)
My answer? There's no set rule for how many layers you should paint. It's really more about how many you NEED.
For me, the first layer is important and helps me to build a cohesive and luminous painting. That's the imprimatura/bistre layer. After that, I might paint an area in one or two layers, but other areas may need many more to get the result I'm after. By layering, I can build up beautifully rich colors and nuanced details with different types of soft textures or glazed layers. (I'm certainly not keeping count of how many layers I'm painting!)