Getting a seed to germinate comes down to a small number of conditions being right at the same time: moisture, warmth, the correct sowing depth, and a seed that's actually still viable. Get all four right and most vegetable seed germinates reliably. Get one wrong and it's the most common reason a tray or row simply doesn't come up.
Sowing depth matters more than most beginners expect. The general rule is to bury a seed only about as deep as its own diameter. Fine seed like lettuce should be barely covered, medium seed like tomato and capsicum needs around 6mm of covering, and large seed like peas and beans, which carry bigger energy reserves to push through, can go in as deep as 25mm. Sow too deep and a seed can run out of stored energy before it reaches the surface; sow too shallow, especially with fine seed, and it can dry out or wash away before it has a chance to root.
The general rule is to bury a seed only about as deep as its own diameter.
Warmth is the next most common sticking point, and it varies a lot by crop. Brassicas and carrots will germinate in soil as cool as 10°C, but tomatoes, sweetcorn and zucchini need soil over 15°C, and capsicums and chillies want at least 20°C to come up reliably. Sowing a warmth-loving crop straight into cold spring soil is one of the most common causes of poor or patchy germination in a New Zealand garden: the seed doesn't rot outright, it just sits there, and cool, wet soil in the meantime makes it more vulnerable to the fungal problems below. Starting these crops indoors or under cover, then planting out once the soil has properly warmed, avoids the problem entirely.
Moisture needs to be consistent rather than heavy. Pre-moistening seed-raising mix before sowing, rather than watering heavily afterwards, protects seeds from being washed out of position. Fine seed dries out fast and needs frequent, light watering to stay damp while it germinates; large seed needs the mix kept moist but not saturated, since waterlogged conditions around a large seed are more likely to cause rot than to speed things up. Letting a tray dry out completely between waterings, even once, can be enough to kill seed that's already started to germinate.
Damping off is the other major cause of a tray failing, and it's a disease problem rather than a sowing-condition problem. It's caused by fungi and water moulds that attack seeds and young seedlings, and they thrive in exactly the conditions an over-eager beginner often creates: overcrowded seedlings, excess moisture, and poor airflow. Affected seedlings either fail to come up at all or collapse at the base shortly after emerging, and once it takes hold in a tray it spreads quickly. Using fresh seed-raising mix rather than reused soil, not overwatering, spacing seedlings so air can move between them, and cleaning trays and tools between uses are the main ways to prevent it.
Old or poorly stored seed is worth ruling out before you blame technique. Seed loses viability over time, faster if it's been kept somewhere warm, damp or exposed to light rather than cool, dark and dry, and a packet that's been sitting open in a shed for a few seasons can germinate at a fraction of the rate of fresh seed even when everything else is done correctly. If an entire tray sown under otherwise good conditions comes up patchy or not at all, and a fresh packet of the same crop germinates fine, old seed was very likely the cause.
If a sowing fails, work through the list in order: check the depth was right for that seed size, check the soil was warm enough for that crop, check the mix didn't dry out or stay waterlogged, look for the collapsed stems that signal damping off, and consider whether the seed itself was fresh. Nine times out of ten, the cause turns out to be one of these rather than anything more complicated.