Courtship in animals

Courtship in animals is the behaviour by which different species select their partners for reproduction. Usually, the male starts the courtship, and the female chooses to either mate or reject the male based on his "performance".
Many animals have mate-selection courtship rituals. Animal courtship may involve complicated dances or touching, vocalizations, or displays of beauty or fighting prowess. One animal whose courtship rituals are well studied is the bowerbird, whose male builds a "bower" of collected objects. Another is the Great Crested Grebe, whose courtship dances were first described by Julian Huxley.
In cases like the Great Crested Grebe, the pairs form life (or at least long-lasting) partnerships. In that case, there are also pair-bonding dances throughout the mating season, and through the whole period of raising the young. If pairs get separated, there are exceptionally vigorous dances when they come together. There are a number of "dance routines" which occur in the different circumstances of life. All this behaviour is inherited, though the individual bird remembers the place and the partner permanently.
It might be thought that courtship only occurs in the kind of animals which have fairly complex brains, such as mammals and birds. This is not the case. Male Drosophila flies have to do a mating dance in front of the female before she will allow them to mate. If the dance is not "correct" for that species, she refuses the male. It was discovered over fifty years ago that, if the male carries a mutation which disrupts the dance, he cannot achieve mating: the females reject him. This behaviour is clearly advantageous to the female, whose genes have a better chance of contributing to the next generation if her partner is biologically fit. Drosophila are by no means the only insects which have mating rituals.
Sexual conflict
Sexual conflict is when the interests of males and females in reproduction are not the same:
Males: their interest is to mate with a large number of completely faithful females, thus spreading their genes widely in the population.
Females: their interest is to mate with a large number of fit males, thus producing a large number of fit and varied offspring.
Mating ritual evolved because it is advantageous for females to have choice of partners. If the female has sperm from more than one male, then sperm competition comes into play. This is competition between sperms to fertilize the egg (only a single sperm achieves the union). In some insects, the male injects a cocktail of chemicals in the seminal fluid together with the sperm. The chemicals kill off older sperms (from any previous mating), up-regulates females' egg-laying rate, and reduces her desire to re-mate with another male. The cocktail also shortens the female's lifespan, so reducing her likelihood of mating with other males. Also, some females can get rid of the previous male's sperm.
After mating has taken place, males do various things to stop the female mating again. What the male does depends on the species. In some species, the male plugs the female opening after insemination. In some hymenoptera, the male provides a huge quantity of sperms, enough for the female's long life. In birds and mammals, the male may fight off other candidate males.
Thus, courtship is the visible part of a complex series of events whereby the males and females come together for mating. The continuation of pair-bonding after mating is common in birds and mammals because the survival of their genes depends on the fertilized eggs reaching maturity. If that requires support from both parents, the rituals are the way the pair keep connected. Established pairs, even in the Great Crested Grebe, will live as singles (often in a large group) outside the mating season.
Outcrossing is the mating of individuals that are not genetically closely related. Courtship during outcrossing faciltitates selection of a beneficial partner. The alternative mating process is inbreeding, the mating of genetically related individuals. Inbreeding leads to increased expression of deleterious traits, a phenomenon referred to as inbreeding depression. Inbreeding often occurs when outcrossing opportunities are limited. Courtship based selection of a partner is an important feature of outcrossing, but is likely less significant for inbreeding.