These two nouns sound exactly the same and have similar meaning, but they differ grammatically.
Precedents are events that precede (come before) other similar, later, events—especially when the earlier events (the precedents) determine how the later events are viewed. This word is often used for legal decisions, since later legal decisions are expected to be similar to earlier ones (precedents). Precedent can also be used for almost any kind of event:
The election of Barack Obama was a precedent for the election of future Black presidents.
Precedence also refers to the property of coming before:
People on foot have precedence over cars when crossing the street.
As you can see in this sentence, the idea of precedence in time often implies precedence in importance—the property of having priority:
The professor has precedence over the students in deciding what to talk about.
This can apply to any kind order, not only order in time:
Safety should usually take precedence over fun.