Spikes - it is a better grip for muddy, sloppy, slippery conditions, grass, loose dirt, steep hills. Further, the extra traction helps to maintain speed during turns. The downside is that it is uncomfortable on hard surfaces.
Flats: Better for courses that include harder surfaces such as hard-packed trails, pavement. Also, it is allowed everywhere. The negative side is that it does not have much grip as in spikes.