There is a lot of anecdotal information about how and when spices deteriorate.
One of the best short descriptions of the actual process was found on this website (in their comment section) - https://www.seriouseats.com/talk/2009/10/do-spices-really-degrade-in-light.html
“The chemical compounds that give spices their characteristics (aroma, color, pungency, etc.) do get altered mainly by oxidation. Oxidation is facilitated by light and heat. Aromatic compounds normally contain a chemical structure called–literally– "aromatic ring," which can be broken by oxidation. after that, they lose the original aroma."
The Huffington Post developed a visual guide which can be found here - https://www.huffingtonpost.com/2012/03/07/how-to-store-spices_n_1324090.html Since this is by the mainstream press, it must be true.
There are lots of questions about how long do spices last. The very unsatisfying answer is, of course, it depends. Besides that it varies for each spice, it largely depends on how you store them. The more exposure to light, air, and humidity the faster they lose they potency. In general, any whole spice (seeds, kernels, etc.) last the longest since they release their flavor when you crush or grind them. On the short end are any herbs in leaf format since each leaf has a large surface area allowing for faster oxidation and evaporation of essential oils. Powders tend to be in the middle, but there are exceptions. For example, Paprika is very fragile and does not store well (think weeks versus months). Sam Sifton of the NY Times discusses the magic of paprika, its freshness, and some great recipes right here - https://www.nytimes.com/2016/04/17/magazine/the-fresher-the-spice-the-better-the-chicken-paprikash.html
Lastly, there is the look, sniff, and taste test. If the test results don’t show strong flavor, it is probably time for replacement.