In Shakespeare's time people knew that Cuckoos appeared in other birds' nests but they didn't know how they got there. They thought that the male Cuckoo mated with a Reed Warbler or Meadow Pipit who then laid a Cuckoo egg. Shakepeare mentions this in Love's Labours Lost:
The Cuckoo then on every tree.
Mocks married men for thus sings he.
Cuckoo, cuckoo. Oh word of fear.
Unpleasing to the married ear.
At this time, if someone's wife was having an affair, people would mock him by calling Cuckoo, hence the quote from Shakespeare. A Cuckold is the wronged husband, which is still used today from the mistaken belief that Cuckoos mated with their hosts, so the male host was "cuckolded".
The female is pretty sneaky when she lays an egg, choosing a moment when the nest is unattended, swiftly removing a host egg then depositing one of her own. A friend of mine tells me he has seen the male and female Cuckoo apparently working in cahoots, with the male drawing attention of the mobbing Meadow Pipits while the female follows behind taking advantage of the distraction to lay an egg.
I took this freshly-arrived male Cuckoo in the Peak District last week.