So first, understand that nutritional value is calculated by determining the calorie count, as well as other factors of the food. A calorie, is simply a unit that is used to measure energy. A person uses food to provide power and energy to our bodies.
To determine the amount of calories a food has, there are labs that use very specific testing to determine the information you will find on your food label. The testing itself is not cheap so it is only done when label reprints are needed or the recipe for the food has changed. Another method is food analysis tables and is much more affordable to have done.
Often they use a bomb calorimeter, measure out a little bit of food, place it in, and blow it up. Then the heat is measured that comes out and the measurement is the direct number of calories for that specific food.
Then to determine the fats, proteins, etc, you will do extractions. The extractions will be done for lipid insoluble and lipid-soluble components, and will be seperated by using chromatography in order to find the vitamins that are fat-soluble (such as K, A, D, and E) and then the rest of the vitamins which are water soluble. Now you burn the food to ash in order to weigh the ash and recover any minerals to determine the exact content of minerals.