Freud described the evolution of his clinical method and set out his theory of the psychogenetic origins of hysteria, demonstrated in a number of case histories, in Studies on Hysteria published in 1895 (co-authored with Josef Breuer ). In 1899 he published The Interpretation of Dreams in which, following a critical review of existing theory, Freud gives detailed interpretations of his own and his patients' dreams in terms of wish-fulfillments made subject to the repression and censorship of the "dream work". He then sets out the theoretical model of mental structure (the unconscious, pre-conscious and conscious) on which this account is based. An abridged version, On Dreams , was published in 1901. In works which would win him a more general readership, Freud applied his theories outside the clinical setting in The Psychopathology of Everyday Life (1901) and Jokes and their Relation to the Unconscious (1905).  In Three Essays on the Theory of Sexuality , published in 1905, Freud elaborates his theory of infantile sexuality, describing its "polymorphous perverse" forms and the functioning of the "drives", to which it gives rise, in the formation of sexual identity.  The same year he published ‘Fragment of an Analysis of a Case of Hysteria ( Dora )' which became one of his more famous and controversial case studies. 
In Freud's view, jokes (the verbal and interpersonal form of humor) happened when the conscious allowed the expression of thoughts that society usually suppressed or forbade.  The superego allowed the ego to generate humor .  A benevolent superego allowed a light and comforting type of humor, while a harsh superego created a biting and sarcastic type of humor.  A very harsh superego suppressed humor altogether.   Freud ’s humor theory, like most of his ideas, was based on a dynamic among id, ego, and super-ego .  The commanding superego would impede the ego from seeking pleasure for the id, or to momentarily adapt itself to the demands of reality,  a mature coping method. Moreover, Freud (1960)  followed Herbert Spencer 's ideas of energy being conserved, bottled up, and then released like so much steam venting to avoid an explosion. Freud was imagining psychic or emotional energy, and this idea is now thought of as the relief theory of laughter.