Assuming that you are speaking of medieval western and central Europe...
Medieval armies did not occupy cities, or anything else. They took cities, sacked cities and villages, conquered territory etc. But occupation forces they were not.
Medieval armies were very small; 5000 men was a very large army: such small forces cannot occupy much. And...
Medieval armies were ephemeral; they assembled when called, and dispersed at the end of the campaign, rarely longer than half a year or so.
Note that this works both for the attacker and for the defender: they both have to do something to bring the conflict to a conclusion within the limited time they can keep forces in the field.
To give a practical, if imaginary, example: let's say the army of Oltenia, all 5000 men of it, invades Muntenia. The goal is to take Targovishty, depose the Muntenian voivode and install in his place an Oltenian ban.
They march across the Olt, and they invest the city of Pitteshty. The defenders resist for a while, but anyway the city is taken -- either by assault, or by terms, or by treachery, doesn't matter.
What happens now? In a modern war, the city would be occupied by the victorious army. But this is the Middle Ages! They taken city now belongs to Oltenia. The Muntenian military are gone, one way or the other. The inhabitants don't give a toss whether they are ruled from Targovishty or from Crayova.
The Oltenians will appoint a new duke of Pitteshty, and let him sort out his new possession, or else confirm the old duke if he swears fealty to the Oltenian great ban; the army will continue towards Targovishty, to finish the business.
Things to remember:
In the middle ages, nations had no political dimension whatsoever; ordinary people did not have feelings of patriotism for a country. Cities changed hands as a matter of course; nobody cared much what was the name of the king.
In the middle ages, ordinary people did not participate in wars of their own free will. The very notion of a volunteer was unheard of. If king A takes a city from king B, the inhabitants won't care much.
Medieval states were very very weak and did very very little. For ordinary people, belonging to state A or to state B had no importance whatsoever.
Elsewhere
But if you are not speaking of medieval western and central Europe, yes, there were powerful realms during the middle ages who could garrison a conquered city. Note that again the garrison is not an occupation force, but rather an ordinary military garrison; once the (Eastern) Roman empire, the Ottoman empire, the Arabs, the Persians, the Chinese took a city it was theirs. Occupation forces make sense only if the city is acknowledged to stll belong to the enemy, but needs supervision during the war; but in the middle ages this concept did not exist.
As for the logistics of such garrisons, they are simple:
Maintain a troop of soldiers in the city. The city and surrounding area will pay them, feed them, clothe them. The central goverment may send inspectors from time to time.