In the narrowest definition, a "replacement child" is a being who is intentionally conceived because an older sibling has recently died. Such substitutes must endure the lifetime burden of competing with a lost and often idealized child. Because it is almost impossible for them to please their parents, they easily become confused and frustrated, or worse.
Here's a dry summary from a learned journal: "When bereaved parents give birth to a child or children subsequent to a perinatal death, their constructions of the family necessarily change. The subsequent child is thought to be at risk of psychopathology (the replacement child syndrome) if parents have not sufficiently grieved their losses." "At risk of psychopathology" is a hesitant, euphemistic formulation.
The term "replacement child" has also been defined more broadly: it may, for example, refer to any child in a family that has lost one or more of its offspring (rather than solely to one conceived as a direct consequence of a death). In an even larger sense of the term, there are all kinds of 'symbolic' replacements: one psychologist has gone so far as to suggest that any Jewish child born after the European holocaust should be so considered. This idea seems extreme.
In pre-industrial societies, replacement children received no particular notice because infant deaths were so very commonplace. While there must be many replacement children in traditional literature, the earliest who comes to mind is Juliet in Shakespeare's Romeo and Juliet, which was written in 1595.
Juliet's biological mother is aloof and distant, but she has a second and more loving parent -- her nurse -- who does much of the actual work of mothering. The nurse has lost her own daughter, Susan, and has become wet-nurse to Juliet. "Susan and she -- God rest all Christian souls --/Were of an age. Well, Susan is with God;/ She was too good for me." Clearly, Shakespeare suggests, Susan has been idealized in her natural mother's mind. The Nurse has a replacement child in Juliet, a state of being that goes far to explain the profound bond between surrogate mother and surrogate daughter.
It is uncharacteristic of Shakespeare to discuss the infancy of his heroines, nor can I think of any other pre-modern work that devotes so much space to wet-nursing or to the trauma of weaning. Although he depicts in detail the relationship between Juliet and her nurse, Shakespeare does not seem to anticipate or foreshadow the interest that later centuries would take in the replacement child syndrome. Instead, he focuses on Juliet's sexual alacrity.
The nurse tells a pertinent story (and leaves us with the impression that she has told it many times before): when Juliet had just learned to walk, she fell and "broke her brow"-- cut her forehead, as we would say. "And then my husband --God be with his soul,/ He was a merry man--took up the child,/ 'Yea,' quoth he, 'dost thou fall upon thy face?/ Thou wilt fall backward when thou has more wit,/ Wilt thou not, Jule?' And by my holidame,/ The pretty wretch left crying and said 'ay.'" "Falling backward" is bawdy talk for a woman's posture in sexual intercourse. Retelling her husband's tale, the Nurse dramatizes her expectation that when Juliet comes of age, or "has more wit," she will be eager to fall backward. To this proposition Juliet -- "the pretty wretch"-- says 'Ay.' Juliet's personal psychology, Shakespeare seems to hint, formed itself to gratify the suggestions of her surrogate mother.
The vigorous sexuality that might be appropriate for the nurse's natural daughter Susan, who would have been a servant girl, has been transferred to the bourgeois Juliet, who, if she had followed the example of her birth mother, would have been properly restrained, repressed, and diffident. In effect, the nurse contrives to live her own desires through her replacement child; the result is Juliet's sexual impetuosity and subsequent death.
William Shakespeare was born in 1564, but an older sister Joan was baptized in 1558 and another, Margaret, in 1562. Both died in infancy. The future playwright was therefore doubly a replacement child.
There's an additional complexity in the family drama because the infants he replaced were female. How this oddity affected his own psychological development is open to speculation. Perhaps because he was the oldest son in a family that had lost two daughters, he was especially cherished. Or perhaps a boy who replaced girls developed the empathy to create complex female characters in an English drama that, until Juliet, had limited itself strictly to one-dimensional stereotypes.