The captain of a mercenary company was often effectively a wealthy businessman. He would supply the initial capital to set up a mercenary company, which would then recruit soldiers to it. As such these men were often from noble families who had the financial backing to establish such a group. A typical way for this to occur will be a king, noble or government will issue a commission to a noble to raise a company for a war. The noble will sometimes be paid an initial commission or may be paid on an ongoing basis. He will then recruit a force (often at his own expense) and go on campaign. Some of these companies will remain together at the end of the campaign and look for a new employer.
These companies were often based around groups of soldiers who already knew each other, either soldiers dismissed at the end of an earlier campaign or a core group from an existing or recently dismantled mercenary company. As such a profession soldier in the late medieval period could expect to fight under multiple commanders and for many different employers, often including both sides in a war. By the end of the Hundred Year War both sides' armies contained a mix of French, English, Scottish, Irish, Italian and German soldiers.
One interesting feature of mercenary contracts was how they were paid - many contracts specified the number of type of soldiers to be supplied at the beginning of the campaign and the amount to be paid but not a per soldier pay rate. This meant that the pay of dead and incapacitated soldiers went to the captain of the company. Other mercenary groups had specific clauses in their contracts such as the Swiss, who would not dig entrenchments or storm breaches in fortresses. The Swiss were also often raised on a stockholder basis - where each soldier was paid a 'share' of any monies earned from pay or loot and had various individual rights in terms of what the captains could or couldn't order them to do or punish them for. However, the Swiss also had a reputation for being the best mercenaries in Europe, so could make demands on their employer that regular mercenaries couldn't.