Why do recipes say to fry spices before adding liquid?
Because the compounds that carry most spice flavour are fat-soluble, and heating spices in fat extracts and disperses them in a way water cannot. The technique is called blooming, and it is the difference between a curry that tastes flat and one that does not.
The chemistry. Spices contain volatile aromatic compounds — essential oils. Cumin's flavour comes largely from cuminaldehyde, cinnamon's from cinnamaldehyde, turmeric's colour and much of its character from curcumin. These are lipophilic: they dissolve readily in fat and poorly in water.
Add ground spices to a watery sauce and much of that flavour stays locked in the particle. Fry them in oil or ghee first and the compounds dissolve into the fat, which then distributes them evenly through the entire dish — every mouthful carries the flavour rather than occasional gritty pockets.
Heat also transforms them. Gentle heating drives Maillard and other reactions in the spices themselves, developing roasted, deeper notes not present in the raw powder, and cooking off the raw, dusty taste that undercooked ground spice leaves.
Curcumin's bioavailability also improves substantially with fat, which is a nutritional as well as culinary reason.
How to do it:
Whole spices first, in hot fat, until fragrant and they begin to pop — typically 30 seconds to a minute. This is tadka or tarka in Indian cooking, and it can be done at the start or poured over a finished dish.
Ground spices need far less time — 20 to 40 seconds — and burn readily, because they are fine and high in surface area.
Keep the heat moderate and keep them moving.
Add a splash of liquid if they threaten to catch, which stops the temperature rising.
Watch for the smell, which changes noticeably when they are ready.
Burnt spices are bitter and unrecoverable, so this is a stage to watch rather than walk away from.
Toasting whole spices dry before grinding is a related technique with similar benefits.