Why can applesauce be used in place of oil?
Fundamentally, the reason for this substitution is that applesauce contains pectin.

In baking, the role of oil is to coat the flour, preventing it from combining with the water (or other wet ingredients) and developing gluten.  Gluten is what causes dough to rise, and also gives elasticity to the final product - what most people think of as "chewiness."

When you're baking, for example, a cake, or even a pie crust, you want to limit the amount of gluten that develops.  A cake or pie crust should be moist, light, and fluffy, not tough and chewy.  When you bite into a cake and find it very dry and bread-like, that is because it has developed a lot of gluten.  A good amount of oil or other fat leads to a lighter, moister, less-glutinous result.

The pectin in applesauce can also, to a certain extent, help to inhibit gluten formation in a dough, but the similarities end there.  I cannot stress this point enough, and I've seen many other online resources get this dead wrong: Pectin (applesauce) is not a straightforward or foolproof substitute for fat.

The mechanisms by which pectin and oil work in this context are completely different:


Oil is a lipid.  Lipids bind to starch (including the ~75% starch in flour) and are hydrophobic - the traditional example of this is dew drops forming on the surface of grass or plants (the latter being the hydrophobe).  In a sense, oil forms a protective "shield" around the flour molecules.
Pectin, on the other hand, is a gelling agent, and specifically a polysaccharide.  Pectin is not hydrophobic and does not actually protect the flour molecules.  In fact, pectin is of the same family as starches, which are also polysaccharides.  What's really happening here is that the pectin competes with the flour for water.  That means less water overall reaches the starch and gluten-forming proteins (giladin and glutenin) in the flour, and because of this, it is not able to develop as much gluten or gelatinize much of the other starch.


What does all of this actually mean for you, the baker?  Quite simply, it means you have to be very careful with this substitution:


Too much pectin can turn your recipe into a jelly-like consistency.
Too little pectin will fail to prevent glutenization (in other words, you'll get bread).
Pectin has the property of syneresis - meaning that once it starts to gel, it also starts to expel liquid, and your dessert will dry out or deflate over time.
Pectin is actually water-soluble at high temperatures (technically, it forms a colloid), it just happens to absorb a lot of water along the way.  Baking for too long, or at too high a temperature, will cause the pectin to break down and dissolve completely, making it useless.


There are also several other problems (or at least "gotchas") when making the apple sauce substitution:


Applesauce is not just pectin.  It has a good deal of water and various proteins and acids, and even a certain amount of lipids.  The exact quantities, however, depend on how the applesauce was made, so it is very hard to get precise control over the amount of pectin, and the textbook 1:1 substitution ratio is almost never correct.
Another thing that applesauce contains is sugar - even unsweetened applesauce.  You will almost certainly need to reduce the amount of sugar elsewhere in your recipe.  This may be difficult, especially if the bulk of the sugar is used as a dry ingredient.
Applesauce behaves somewhat similarly to oil, but do not even try using it as a substitute for any other fat.  Butter, in particular, contains milk proteins which act as natural emulsifiers; pectin does have certain stabilizing properties but is a rather poor emulsifier compared to butter[citation needed].  And it goes without saying that the flavour is substantially different from that of applesauce; oil is "OK" to substitute for because it has very little flavour of its own.


If you plan on using applesauce as a substitute for oil in a recipe that does not specifically explain how to use it as a substitute, then I strongly suggest you do two things:


Don't substitute the entire quantity.  Use 1/2 oil, 1/2 applesauce, or maybe 1/4 oil and 3/4 applesauce.  You will likely also have to lower the total quantity of oil/applesauce to approximately half of what it originally was (give or take 1/4).
If you can, try this substitution on a small scale first, and experiment with the quantities of oil, sugar, and applesauce, before going all-out and putting it into the oven while your guests arrive.  It's very likely that on the first few attempts, you'll end up with something that's palatable, but nowhere near the quality of the oil-based recipe.


Ignore these disclaimers at your own risk!