Solid fats mixed into a dough or batter trap air, water, and some leavening gases. When the fats melt, these gases are released and the water turns to steam, both of which contribute to leavening.
Different fats have different melting points, but most fats used in baking melt between 90° and 130°F(32° and 55°C). Gases released early in baking are more likely to escape because the structure isn’t set enough to trap all of them. This is why puff pastry made with butter, with a low melting point, doesn’t rise as high as puff pastry made with puff paste shortening. On the other hand, the high melting point of shortening makes the pastry unpleasant to eat.