What is the purpose of proofing dough in several stages
There are three steps in bread making commonly referred to as "Proofing"
The first step is also called fermenting (or proofing the yeast, which, I believe, is not what you are asking about).

The first rise (also called proofing or bulk fermentation) is about increasing the volume. This is the primary breeding period for the yeasts once they are incorporated into the dry goods. 


  It's during our bulk fermentation that the yeast does the majority of
  its work, helping our dough gain flavor as ethanol and other
  byproducts are produced, and gain structure as CO2 inflates our gluten
  network.


The second rise, or final proof, of the dough is maturing the flavor and texture. Having risen in volume and then being shaped much of the gas created in the first raise is released, but the gluten 'matrix' is preserved. How much (or how vigorously) we 'punch down' the dough will create a bread of more fine air pockets while a dough that is barely worked will preserve some of those original air pockets and will create a bread with a more course interior. Additionally the final proof can be used to allow the loaf to take it's final form. Sometimes this is because it is in some container (loaf pan, dutch oven, etc.). It is simply easier to allow the dough to fill the pan by expanding into it. If time permits it is often beneficial to 'retard' the final rise, slowing the rate of expansion, by placing the dough in a refrigerator. This will, obviously, take more time, but the reward in flavor is (IMHO) worth it. 


  Proofing our loaves in the fridge (also called retarding) will slow
  down their final rise, giving our loaves more flavor. Also, retarding
  loaves during their final proof makes them easier to handle and score
  before baking, which will improve the crumb, crust, and appearance of
  our baked loaves.


There are a variety of more detailed explanations available online. This article from 'Serious Eats' is a good starting place.