Puffing is caused by steam evaporating inside the dough. The gluten matrix holds the steam in, especially after you've cooked it on one side. If you cut into the puffed dough, you'll notice that a lot of hot steam escapes.
Be careful when you do that. You can burn yourself. I speak from experience. Besides, the texture is better if you give it a few minutes to set up completely: cut it too early and the cutting force can glue the edges together.
You get similar effects in naan, tortillas, and chapatis. These are also generally un-yeasted. The yeast doesn't have time to produce that much air, and it's quickly killed. (I use yeast in mine anyway because I like the texture and flavor.)
As for getting it to puff every time... it seems to be a knack. Preferably learned from one's grandmother, I gather, but I didn't. The way I do it is to mimic a tandoor. While I shape the dough, I preheat a cast iron pan and the broiler. When ready, I put the dough on the pan and pop it into the oven. Cooking on both sides simultaneously means it cooks on the outside, making a steam-proof seal.
It can be done just with the frying pan. It's a matter of timing, flipping it when it's sufficiently cooked on one side to set, but not cooked through. I haven't mastered that, I'm afraid, but many others have.