How do food producers determine expiration dates on products and ingredients? 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?
To determine the shelf life of products, there is usually a microbial activity test conducted over a specific time frame. For instance, in baked goods with an expected shelf life of 7 days, you would send 4 or 5 of the product to a lab. They would use one to measure the initial microbial activity, then perhaps 2 days later, they would measure another one, etc. Generally companies have an acceptable threshold of microbial activity, so the shelf life is set by how many days it takes the product to reach that level.