In the Second Persian Invasion of Greece, how did the Persians manage and distribute food for such an immense number of people in their army over such a long distance traveled?
The first thing to understand is that the traditional numbers from Herodotus (1.7 million+) and later Greco-Roman sources (even more) are considered impossible by modern research. Logistically they would have been nearly imposible to gather in one place. It would still be nearly impossible for a proportional population. Just taking that many people out of their local economies and ecosystems and marching them through another would have been disastrous.
Modern estimates point to a smaller number, that is still a genuinely massive army. 200,000-300,000 strong according to most estimates. This would still require creativity and planning, but it would not be impossible.
Fortunately for the Persians, they never had to go far from the sea. The fleet could move parallel with the land army. A cargo ship nearby can carry a lot more than a train of carts and camels. That took some of the burden off the land-bound supply line. Ships also could potentially ferry supplies from Anatolia while the campaign was ongoing.
This even contributed to a major infrastructure project in the Chalcidices. In 492, Mardonius first invaded Europe to re-occupy Thrace and Macedon, and possibly attempted to invade new Greek territory, his fleet was wrecked off of Mt. Athos. Xerxes had a canal cut through that peninsula to circumvent the rough seas near the mountain.
Of course, there was still a supply line on land because sometimes the army could not be right on the coast. Particularly in the early stages of the campaign, traveling through Thrace, mountains and rough terrain was an impediment to maintaining supply lines. One theory is based on Herodotus' description of two bridges crossing the Hellespont. It's possible that the supply column marched parallel to the soldiers until they were in hostile territory.
The continuous friendly territory also supported their supplies. The Eastern Mediterranean had Persian territory on 3/4 sides, and the land route met no meaningful resistance until Thermopolae. Thessaly, in northern Greece, was even inviting the Persians in according to Herodotus. The supply lines were relatively secure at land and sea all the way back to Mesopotamia.
Speaking of Thessaly, that brings me to where all of the supplies to feed this army actually came from. Having the best grain growing region in Greece on their side from the start must have helped secure their food supply. Babylonia and Egypt had also revolted, and been defeated, four years earlier. As a consequence, Xerxes may have demanded more of their harvest as tribute, providing even more of the best agricultural regions' produce than Darius' taxes would have allowed in peace time.
That brings me to a broader point on how Persia could support such a large army. They ruled the world. Not the whole literal globe, but nearly all of the most developed regions and economies of the 5th century BCE. A system of royal roads had been constructed and connected to expedite travel and trade from Parsa and Media in the east all the way to Egypt and Lydia in the west. They could efficiently move supplies from other provinces to the front.
The final trick to sustaining this invasion force is that they don't seem to have stuck around. After the defeats at Plataea and Salami, Xerxes and most of the army crossed back to Anatolia. Herodotus says this was to defend the bridges, but Arrian and Ctesias both suggest that another revolt may have erupted in Babylon. Babylon was much more important to Persian power than Greece, so Xerxes probably gave it priority and pulled troops out of Greece, taking pressure off of Mardonius and the occupying forces.
But, at the end of the day, this was all still tenuous. Herodotus says that many Persians starved during their retreat out of Europe. The fleet was vulnerable to attack after Salamis, the army (supply train included) was supposedly in disarray after the death of Mardonius, and the Greeks could press their advantage. With this disruption, previously friendly elements like Macedon turned on the Persians and those complex supply lines could no longer reach the army.