It's probably due to the popularity of "Game of Thrones," but there has been a great deal of interest in how bastards were defined and treated during the Middle Ages. As you have probably come to expect if you've been reading this blog for a while, it was complicated.
We now think of illegitimacy as simple: if the parents are married the children are legitimate, if not, not. But even now there's a lot of gray area. These days many couples are living together, with their children, on an essentially permanent basis, but are not married. The children are not mocked as bastards at school (or at least one hopes not). Some children were born to married parents, but now the parents are divorced--does this change things? Sometimes a man recognizes paternity and pays child support, even if he is no longer a couple with the child's mother, whom he's never married--how different is this from Divorced Dad?
There were at least four different categories of illegitimate children in medieval law. A manzer, a term with Hebrew roots, was a child born to a prostitute or sometimes to an incestuous union, that is a child whose parents' relationship was considered morally wrong. A nothus, a word with Greek roots, was the child of a married woman due to an adulterous affair, also morally wrong. A spurius was the child of a couple who could not have been married, such as a citizen and a non-citizen (in those cities that regulated who citizens could marry), or a well-born man and a slave in late antiquity, or a married man and a concubine. A naturalis was the offspring of a couple who could have married and indeed might do so in the future; this last category was treated fairly indulgently, the product of "young love" that got carried away.
In spite of medieval lawyers' efforts to create clear categories, the exact definitions of these four terms was fairly fluid. A chronicler might decide to call the son of a lord and his concubine a manzer rather than a spurius if he disliked the son. Someone showing off his Greek might call any child of an unmarried couple a nothus. Whether the mother or the father was the highborn adulterer, some chroniclers would use nothus, some spurius. By the twelfth century, the words illegitimus and bastardus were also in common use, meaning any child whose birth seemed somewhat irregular.
Even though there was an expectation that a bastard (especially a manzer) was more inclined to bad behavior than the average (we still use bastard to mean someone behaving especially badly, without necessary reference to his parents' marital status), in practice bastardy did not always carry a stigma. Children of concubines might be brought up along with their half-siblings. Fathers could and did legitimize illegitimate children. Parents might be severely chastised for irregular unions, but the children generally got off easy.
The biggest concern was the inheritance. Children of a married couple would automatically inherit, but it got tricky if the parents were not married to each other. A nobleman might take a noble woman as his concubine as sort of a "test drive," then marry her when she got pregnant, and there would never be a question about their children's inheritance, but on the other hand the children of the same nobleman and a peasant woman didn't stand a chance--though they might get some nice gifts occasionally.
Some bastards did very well for themselves. Charlemagne's grandfather, Charles Martel, was the product of a bigamous union. William the Conqueror, who became king of England in 1066, was considered a bastard because his parents were not properly married. Henry I of England had at least twenty illegitimate children, and many of the boys became bishops. When King Philip II of France rejected his wife, he had several children with other women (during the time while his wife tried unsuccessfully to get back her position as queen), who were eventually legitimated and given comfortable lives.
Even in the stories, bastards might do well. Sir Galahad, the peerless knight in the King Arthur stories who finally found the Holy Grail, was a naturalis, son of Lancelot and Elaine (whom he'd thought was Guinevere, it was dark, but that's another story). Even in the Bible, King Solomon would have been a nothus by medieval law standards, son of David by an adulterous relationship with Bathsheba.