There are two different methods to collect seeds the Dry Method and the Wet Method.
It involves crushing mature seed heads and separating the seeds by winnowing (blowing air over the seeds in order to remove the fragments of heads and stems). For a detailed explanation of how to winnow seeds see Saving Lettuce Seeds.
Vegetable seeds that can be harvested using the dry method include lettuce, endive, carrot, brassicas (cabbage, broccoli Cauliflower etc..), leek, onions, Pak choi and mizuna.

Saving lettuce seeds using the winnowing dry method.
This involves scraping seeds off the insides of fruit (examples being Capsicum and chilli) or crushing seed pods and picking out the seeds (examples being peas, beans and broad beans).
This involves washing the seeds in a sieve with a jet of water before tipping the seeds out onto paper towel to dry. For a detailed explanation of this method see Saving Tomato Seeds.
Vegetable seeds that can be harvested using the wet method include tomatoes, pumpkins, zucchinis, eggplant and cucumbers.

Saving tomato seeds using the wet method.