How is molar mass calculated?
Every element in the formula contributes its standard atomic weight multiplied by how many atoms of it appear. Those weights are averages across each element's natural isotope mix, which is why they are rarely whole numbers — chlorine is 35.45 because roughly three quarters of natural chlorine is Cl-35 and one quarter Cl-37. Percentage composition is each element's total contribution divided by the whole.