Parts of it look simple. For example, weight loss requires that we expend more energy than we take in. If the energy content of our intake is mostly sugars, then our body doesn't really have a lot of engines set up to process other elements of our diet. So if we suddenly reduce the sugar content of our diet, these other sources of energy become important. The body will adjust to the new mix of energy sources, but it will take some time.
Energy balance is probably the most basic element of our diet.
However, there are substances which our body needs to function, for which we either require raw materials to produce them, or we need to ingest them as our body either can't produce enough, or it can't produce them at all. But as you seen above, it is possible to manipulate the diet in such a way, that even an apparently balanced diet can be upset. If we do not supply our body with all the building blocks it requires to get through daily living, eventually something will happen to reduce our fitness or well being. Their are proteins which we require, which are absent in almost all vegetable sources. If we lack the mineral, we can't make enough of some enzyme, and we suffer.