It goes something like this. The system starts out as about 20 sacs, each composed of roughly 80 cells. As the embryo develops, these sacs sprout branches. At first, six small groups of cells migrate from each sac to form so-called primary branches. But it doesn't stop there.
Most secondary branches go on to form elaborate networks ending in fine 'terminal' branches.
Each terminal branch itself forms a tree-like structure that contacts just about every lung cell, providing it with its own supply of oxygen. Formation of these terminal networks is a complex process, and if the tissues are starved of oxygen the networks compensate by becoming even more complicated. They started from a hypothesis, proposed over 50 years ago, that oxygen-starved cells produce a signal that attracts terminal branches. To test this, they exposed groups of cells in fly larvae to low levels of oxygen. As expected, they saw increased sprouting of terminal branches in oxygen-deprived areas.