Sex is a special theme in confession because our sex life is generally something hidden, a secret that has to be drawn out. The listener, and not the speaker, is in the position of authority, and the act of confessing is seen as therapeutic. In the 19th century, psychiatrists tried to bring together confession and scientific discourse to create a "confessional science" of sex. Foucault lists five ways confession and science were brought together. First, certain codified methods, including examination, hypnosis, and free association, were developed to regulate the extraction of a confession. Second, seeing sex as the cause and explanation of all sorts of different behavior created the need for a thorough and exact confession. Third, seeing sexuality as something latent within us created the need to draw it out. Fourth, psychiatry developed a method of interpreting confessions that made the response of the listener essential for understanding confessions. Fifth, seeing confession as therapeutic gave it the aura of a medical procedure.
Thus, the tradition of confession was combined with scientific discourse to create our modern concept of sexuality. This concept has more to do with the discourses around it than with sex itself. On the one hand, it is connected with confession, which deals with the secret ills of the human subject. On the other hand, it is connected with science, and so is associated with knowledge and truth. These two discourses combined lead us to think of sex as something secret and suspicious, but also as the key by which we can discover the truth about ourselves.
In closing, Foucault asks if perhaps we could see our modern scientia sexualis as infused with the same knowledge of pleasure that characterizes the ars erotica. Rather than knowledge of sensual pleasure, we discover a pleasure of analysis, the pleasure of learning about our pleasures. Foucault suggests that rather than seeing power as repressive, we should look at power as the force that creates our knowledge and our truth for us.
Nietzsche is influential in Foucault's work. Foucault's later work in particular follows what he calls a "genealogical" method, which he learns from Nietzsche's works, particularly the Genealogy of Morals. In his essay, "Nietzsche, Genealogy, and History," Foucault discusses Nietzsche's distinction between "origin" and "genealogy." When we talk about something as having an "origin," we mean that it has a fixed starting point from which it has evolved or devolved since that time. The story of Adam and Eve is an archetypal origin story. Because we can point to Adam and Eve as a fixed starting point for human history, we can identify in that origin story what is essential to human nature. We find in our origin the concept of original sin, and we can also find a fixed morality set down by a rigid God who created us in a particular way.
Genealogy, by contrast, does not identify any fixed starting point or any rigid meaning to the way things are. When we talk about something's "genealogy," we talk about the circuitous, often random, path that has led to its present state from an equally contingent earlier state. We might contrast the "origin" story of Adam and Eve to the "genealogical" account of Darwinian evolution. According to that theory, there is no fixed starting point for humanity, no original state to which we can point and say, "that is our essential nature." The theory of evolution traces our descent from early primates as characterized by randomness and natural selection. There is no meaning or purpose to the route our evolution has taken, and there is no easily identified starting point or human essence.
Nietzsche uses the distinction between genealogy and origins to trace a genealogy of morals, and show that our concepts of right and wrong are contingent results of the haphazard evolution of human society. Foucault borrows this genealogical method from Nietzsche to trace, in this case, the genealogy of our concept of sexuality. "Sexuality," Foucault suggests, is by no means a fixed term that identifies an objective concept in the world. Rather, it evolved in the nineteenth century as a result of the peculiar marriage of scientific discourse and confession. Before the nineteenth century, there was no such thing as "sexuality," as such. Strong arguments have been made, for instance, to suggest that calling the Ancient Greeks "homosexual" or "bisexual" is mistaken, since those categories only properly apply in the modern world.