It is well known that food expiration dates are somewhat arbitrary. For some foods, they are much more important than others -- for example, you can pretty easily tell on your own if milk has gone bad based on smell or taste, or yoghurt that has grown mold. Not so much the case with other kinds of foods, such as dry ingredients, granola bars, dried pasta. However they all have expiration dates.
How does a company which produces food or food ingredients determine the expiration date? Is there a specific scientific process? To what extent are they "fudged" by companies, who either (or both) want to spur customers to make more frequent purchases, or limit liability?