How can molecules with the same molecular formula be different?
Molecules with the same molecular formula can be different because their atoms are connected in different orders.
They have the same molecular formula but different structural formulas. We call them isomers.
For example, there are two isomers with the molecular formula C₂H₆O.
One is ethanol (alcohol), the compound that gets you drunk. The other is dimethyl ether.
In one, the atoms are joined in the order C-C-O; in the other, the order is C-O-C.
This gives the compounds completely different physical and chemical properties.
Ethanol contains an O-H group, so it has hydrogen bonds. It is a colourless liquid that boils at 78 °C. It takes part in many chemical reactions.
Dimethyl ether has no hydrogen bonds. It is much less polar than ethanol. It is a colourless gas with a boiling point of -24 °C. It is relatively unreactive. Instead of getting you drunk, it damages the skin and eyes. Inhaling it causes asphyxiation.