For example, did one need to go to a dedicated school for jesters? Or perhaps kings just went around hiring people they found funny?
Also, in Crusader Kings II and Crusader Kings III, assigning anyone as a court jester gives them an opinion malus with you. Was the job of court jester seen as that undesirable?
Depends on the period you're thinking of.
I'll speak to English history specifically since that's what I'm familiar with, but for the majority of the medieval period, court jesters were most often called fools.
(Among others, the Latin term 'joculator' was also used and is closer in literal meaning to jester, but what we mean when we say 'jester' is really a court fool. Joculator, mimus, etc. were all vaguer terms that could mean multiple things.)
Although the link between folly/intellectual disability and court spectacle had a long prehistory stretching back to classical antiquity, fooling as a medieval profession did not emerge until the 12th century. Prior to that, kings' retainers and brothers-in-arms who served as entertainers might have cropped up here and there in the historical record, but that wasn't their primary role. Professional minstrels would also pass through the king's halls and deliver entertainment that included jokes—these were sometimes the joculatores I mentioned above, and we start seeing them mentioned in the 11th century—but they were not a permanent fixture of courtly life.
The term 'fool' became firmly attached to certain members of the royal entourage in the 12th century, but at the time, they retained additional positions such as houndmaster, messenger, hunter or even in some cases sergeant or knight. So at this point in time it could be said that you became the king's fool by performing for him at certain times (particularly around Christmas), but that alone was not enough to justify your place in the royal household and you still had to serve the king in multiple ways.
An example from around this time would be Roland the Farter, who received a sergeantry from Henry II and the condition for keeping it was that he would appear at Henry's Christmas feast every year and perform "a leap, a whistle and a fart." You can find a reference in Robert Bartlett's England Under the Norman and Angevin Kings, which is an excellent overview of the cultural and political history of the entire period.
(Popular websites love the story of Roland, so you can find summaries of it in many places online, but as far as I can tell, they all introduce him as a professional flatulist whose only job was to fart on Christmas. That's extremely unlikely; the estate he received from Henry was too valuable for that, and moreover, if he really was a professional farter whose work so amused the king, surely he would have been required to perform more frequently than once a year. It's more likely that he was a regular member of the royal household who became famous for his farting performances at feasts and Henry incorporated a reference to his party tricks in the terms of Roland's land tenure because, well, the king could do that.)
Later on—around the 13th century—we start to see a shift from members of the royal household serving as fools in addition to performing their other duties to kings hiring minstrels, actors, acrobats, etc. to provide that service at court. Fooling became a type of professional performance. Kings would still keep fools, but these people were now more likely to be professional minstrels specialising in fooling, OR to be genuinely intellectually disabled people who had been specially procured for the king in some way. (We have extremely little information on how exactly this happened, which is, I realise, the crux of your question.) We also get references to lesser nobles and even wealthy commoners keeping fools in their households. The line between performance and intellectual disability looks very blurry from the distance of time and it's hard to say which of these fools were acting and which weren't. What's clear is that they were all kept on for a weird combination of reasons: to provide entertainment, because fools were supposed to say and do really silly things that were funny to regular people (as conventional wisdom had it at the time), and also for charity and to humble their masters by reminding them of the transience of worldly riches. At this time, most Christian theologists considered intellectually disabled people to be untouched by vices like greed and pride, so they served as examples of spiritual purity and a direct connection to the divine in addition to being the butt of many jokes. Again, it was a weird mix of cultural attitudes.
Kings in particular loved to laugh, so their fools at least were, whatever their mental capacity, likely to be skilled at different forms of live entertainment: pranks, skits, impressions, dancing, acrobatics, juggling, music, knife-throwing, etc. They were often made to dress up as knights, or the king, or various animals, and pretend to be those things—but in an obviously 'foolish' way, which made it funny. They sung irreverent songs, ran naked through the halls, made huge messes at dinner, kicked and bit fussy officials who annoyed the king, etc. As opposed to the earlier figure of the fool as an otherwise ordinary member of the royal household who occasionally performed funny songs/party tricks, the fool who emerged in the 13th century was a full-time entertainer. Again, some fools were at the very least believed by their contemporaries to be intellectually disabled, but many weren't, and all seem to have been trained in the performing arts. So, to finally give you an answer, they were often recruited from acting troupes and minstrel guilds, or perhaps they were picked up on the street because of their disability and then they were given the training they needed to become court fools. France was the European capital of minstrelsy and all manner of aristocratic indulgence in the 13th and 14th centuries, so many of the famous fools of this period came from there.
(As an aside, I'll say court fools almost always used pseudonyms/performing names instead of their real names. For example, there were several fools in the service of the English royal family during the reigns of Edward II and Edward III who were called Robert le Fol, which has always reminded me of the practice of giving consecutive pets the same name. This detail speaks to both the constructed nature of medieval court fools' personas and the power kings had to construct said personas.)
The ratio of disabled to non-disabled fools is a question several historians have tried to answer, but there is really no way to settle it; I personally think the majority of court fools who became famous enough to appear in the historical record must have been able to exercise some measure of deliberate control over their careers and had rare skills that took training to acquire—neither of which is incompatible with having an intellectual disability, to be sure—and more generally that the majority of professional fools in the 13th through 16th centuries were performers because we get a few contemporary polemics against the immoral practice of feigning intellectual disability for entertainment. However, I also suspect quite a few intellectually disabled people were taken into rich merchant and aristocratic households and made to inhabit the role of a household fool, sometimes against their will and perhaps with varying levels of understanding of what was expected of them, which sounds like a really sad fate to me (though perhaps no sadder than many contemporary alternatives).
A final note on disability here: in the medieval medical and moral imagination, intellectual disability was linked to physical irregularities such as hypercephaly (having a giant head), dwarfism, deformities and even abnormally large genitalia. So sometimes people with such physical characteristics, especially dwarfs, were recruited and trained as fools. We also know about a number of famous dwarf acrobats and dancers across England and France from this period who were not professional fools but simply general entertainers, often travelling as part of an acting troupe or accompanying a famous fool or minstrel. And sometimes they secured permanent positions in royal and aristocratic households the way fools did (but were, again, not always called fools). There seems to be some kind of correlation in the sources between fools/entertainers with dwarfism and female aristocratic patrons, but that's just my personal observation.