Zumdahl Chapter 3: Determining the formula of a compound

The formula of compound is determined by taking a weighted sample of the compound and burning it in O₂ atmosphere to produce substances such as CO₂, H₂O and N₂ which, then collected and weighted. 

.A schematic diagram of the combustion device used to analyze substances for carbon and hydrogen 
The sample is burned in the presence of excess oxygen, which converts all its carbon to carbon dioxide and all its hydrogen to water. These products are collected by absorption using appropriate materials, and their amounts are determined by measuring the increase in masses of the absorbents.

So the formula might be: CH₅N or its multiples e.g.: C₂H₁₀N₂, C₃H₁₅N₃ and so on. Any molecular formula can be represented by (CH₅N)n where n is an integer and CH₅N is an empirical formula

To determine the molecular formula we need: 
1- The empirical formula 
2- Molar mass of the compound (to determine the value of n by dividing the molar mass on empirical formula mass).