I believe most installers, and for that matter most designers, probably use the tables in the National Fuel Gas Code book.
The tables are derived using formulas of fluid dynamics. I don't know if I have ever even seen such a formula, but suspect it is fairly complex, involving the calculus.
The diameter of a pipe, and to a lesser extent, elbows and fittings, cause friction in a pipe as any fluid....gaseous or liquid....flows through it. The friction causes a drop in pressure.
A gas appliance needs a certain minumum pressure at the inlet, and in full operation will need "X" many cubic feet per minute. The tables allow you to select a pipe size that for the distance in question will deliver at least the minumum number of CFM to satisfy all the appliances connected to it.
The project then boils down to laying out the appliance loads and the pipe runs and adding up cfms.