The different types of mountain bike also generally align to the types of racing - cross country, enduro and downhill
The one exception is probably the trail bike category, which falls in between cross country and enduro, but isn’t usually the “best” bike for a given style of racing, as it’s more of an all-rounder bike.
Typical suspension travel is:
Cross country: 120mm or less, often hardtail, increasingly full suspension
Trail: 120-150mm travel
Enduro (sometimes called all mountain): 150-170, maybe 180mm
Downhill: 180mm or more
The most common races are cross country, of various formats and lengths that Nate described. They’re a lot of fun.