How are chemical formulas constructed?

Chemical formulas are deducted from the chemical composition of a substance; and the chemical composition is established by chemical analysis.