Answer is: The shape of the molecule fits into a complementary pocket on the taste receptor protein.
When food (sugars, proteins, fats) or other substances (salt, carbonated water) enter the mouth, molecules interact with saliva and are bound to taste receptors.
There are 5 tastes: sweetness, sourness, saltiness, bitterness and savoriness.