By far the best source I've read about the nature of medieval armies was John France 'Western Warfare in the Age of the Crusades'. France's analysis of the formation of medieval armies was way too elaborate and nuanced to reproduce here but I'll try and provide a summary along with some other pertinent information I've come across.
Much like...well every other medieval scholar for the last 50 years, France dismisses feudalism as a means of understanding how medieval warfare worked. Instead he uses mouvances (that should really be in italics but I don't know how to do that on reddit and I'm too lazy to learn) to explain how society and warfare were organised. Mouvances were the core of a king or lord's support base, made up of family and close friends. In times of war a lord would put out a call to arms and the members of his mouvance would rally whatever smaller supporters they had and raise forces. Mouvances were a necessity because their bases of power were normally located near their lord and medieval logistics struggled to support long-range expeditions and because the de-centralized, ineffective government of the Early and High Middle ages made it hard to rely on anyone but your friends and family (who were additionally indebted to you for providing shiny new loot on every campaign).
The composition of a medieval army vary widely throughout the period, across time and place. The most popular idea of a 'medieval army' corresponds roughly to a western European army during the high middle ages (11th-14th centuries). The core of this model of army were heavily armoured, highly trained knights who would mostly have been in the service of a lord who was called to the campaign. The bulk of the army consisted of militia who were moderately to poorly armed and without any formal training. Every free man in most countries was obligated to maintain certain weapons in case they were called to serve their lord in battle, although the mechanics of exactly how they would be called up remain largely unknown (at least from what I've read). The army would then be rounded off by mercenaries hired for the campaign. Mercenaries were mostly organised into their own companies or serving as specialists (such as engineers) but it's worth noting that the line between mercenary and knight or mercenary and militiaman were often somewhat blurred.
I asked a similar question here several months ago, if those answers are of interest.
It would be best to narrow this down into a more specific time and place. Carolingian France, England under Richard I and the Swiss Confederation in the Burgundian wars had different ways of raising armies.