Every smell you notice is made of molecules that have travelled through the air into your nose. A banana, a cup of coffee and a pine forest all send molecules your way.
To reach your nose, a molecule first has to get into the air, so smell molecules are small and light, and the pulls between them are weak enough for them to evaporate at room temperature. The banana ester, isoamyl acetate, C₇H₁₄O₂, is one. Sugar has no smell: the hydrogen bonds between its -OH groups hold its molecules together, so they stay in the bowl.
High up inside your nose is a small patch of tissue, a few square centimetres in all, covered in a thin layer of mucus. Smell molecules dissolve in the mucus and reach the ends of millions of nerve cells. Each nerve cell carries smell receptors: proteins with a pocket, like the receptors that medicines fit. When a molecule settles into the pocket, the receptor passes a signal into the cell, and the nerve sends a message to your brain.
About 400 kinds
Your genes hold the instructions for about 400 kinds of working smell receptor, and each nerve cell carries just one kind. Each kind has its own pocket, lined with its own groups in their own places.
A receptor responds to every molecule that fits its pocket well enough, and each molecule fits several kinds of receptor. So a smell is a pattern: the set of receptor kinds a molecule switches on, and how strongly. Your brain reads the pattern, the way you read a word from its letters. With about 400 letters to combine, the patterns can tell apart far more smells than there are kinds of receptor.
Most real smells are mixtures. The smell of fresh coffee comes from hundreds of different molecules at once, and your brain reads all their patterns together as one smell.