Plato and Aristotle saw it as a tool to topple the mighty. It often accompanies gruesome acts of cruelty. Most of us will use it more routinely – to win friendship and love. So what lies behind the apparent spontaneity of laughter?

Consider the bizarre events of the 1962 outbreak of contagious laughter in Tanganyika (now Tanzania). What began as an isolated fit of laughter in a group of 12-to 18-year-old schoolgirls rapidly rose to epidemic proportions. Contagious laughter propagated from one individual to the next, eventually infecting adjacent communities. Like an influenza outbreak, the laughter epidemic was so severe that it required the closing of at least 14 schools and afflicted about 1,000 people. Fluctuating in intensity, it lasted for around two and a half years. A psychogenic, hysterical origin of the epidemic was established after excluding alternatives such as toxic reaction and encephalitis.

Laughter epidemics, big and small, are universal. Contagious laughter in some Pentecostal and related charismatic Christian churches is a kind of speaking in tongues (glossolalia), a sign that worshippers have been filled with the Holy Spirit. Before looking askance at this practice, consider that it was present at the historic Cane Ridge revival of 1801, in Kentucky, and part of an exuberant religious tradition in which the Shakers actually shook and the Quakers quaked. Even John Wesley, founder of the Methodist Church, did some of his own quaking and shaking. Those experiencing the blessing of holy laughter spread it back to their home congregations, creating a national and international wave of contagious laughter. Contrast, now, the similarity between the propagation of such religious anointings and what was called the "laughing malady puzzle in Africa". They are strikingly similar, tap the same social trait, and are an extreme form of the commonplace, not pathology.

Laughter yoga, an innovation of Madan Kataria of Mumbai, taps contagious laughter for his secular Laughing Clubs International. The laugh clubbers gather in public places to engage in laughter exercises, seeking better fitness and a good time. Kataria's revelation was that only laughter is needed to stimulate laughter – no jokes are necessary. Meetings start with unison laughter exercises, moving on to more unusual variants. This self-described "laughing for no reason" produces real, contagious laughter and is fun for the self-selected participants, but its claimed medicinal benefits remain a matter of conjecture.

The Tanganyikan and holy laughter epidemics, and laughter yoga, are dramatic examples of the infectious power of laughter, something that most of us may have experienced in more modest measure. Many readers will be familiar with the difficulty of extinguishing their own "laugh jags", fits of nearly uncontrollable laughter. We also share yuks with friends and join the communal chorus of audience laughter. Rather than dismissing contagious laughter as a behavioural curiosity, we should recognise it (and other laugh-related phenomena) as clues to broader and deeper issues. When we hear laughter, we become beasts of the herd, mindlessly laughing in turn, producing a behavioural chain reaction that sweeps through our group, creating a crescendo of jocularity or ridicule.

The use of laughter to evoke laughter is familiar to viewers of television sitcoms. Laugh tracks (dubbed-in sounds of laughter) have accompanied many sitcoms since 9 September 1950. On that evening, The Hank McCune Show – a comedy about "a likable blunderer, a devilish fellow who tries to cut corners only to find himself the sucker" – first used a laugh track to compensate for the absence of a live studio audience. Although the show was short-lived, the television industry discovered the power of canned laughter to evoke audience laughter.

The music recording industry recognised the seductive power of laughter with the distribution of The Okeh Laughing Record, which consisted of trumpet playing intermittently interrupted by highly infectious laughter. Released shortly after the first world war, it remains one of the most successful novelty records of all time. Acknowledging the commercial potential of this novelty market, jazz greats Louis Armstrong, Sidney Bechet and Woody Herman, as well as virtuoso of funny music Spike Jones, all attempted to cash in with laugh records of their own. Classicists may add that performers in the Athenian Theatre of Dionysus scooped everyone by more than 2,000 years, when they hired people to cheer or jeer to influence the audience and judges of their tragedy and comedy contests.

The innovation of laugh tracks in early television shows kindled the fears of some cold war-era politicians that the pinko media was trying to surreptitiously control the masses.

Psychology researchers jumped on the new phenomenon of "canned" laughter, confirming that laugh tracks do indeed increase audience laughter and the audience's rating of the humorousness of the comedy material, attributing the effect to sometimes baroque mechanisms (deindividuation; release restraint mediated by imitation; social facilitation; emergence of social norms, etc). Decades later, we learned that the naked sound of laughter itself can evoke laughter – that you don't need a joke.

Recorded laughter produced by a "laugh box", a small, battery-operated record player from a novelty store, was sufficient to trigger real laughter among my undergraduate students in a classroom setting. On their first exposure to the laughter, nearly half of the students reported that they responded with laughter themselves. (More than 90% reported smiling on first exposure.) However, the effectiveness of the stimulus declined with repetition. By the 10th exposure, about 75% of the students rated the laugh stimulus as "obnoxious", a reminder of the sometimes derisive nature of laughter, especially when repetitive and invariable. With repeated exposure, I also grew to hate the sound of the canned laughter, wincing when curious students pushed the "On" button of one of the boxes in my office. Only disarmed boxes with batteries removed are now found on my desk.

It is unpleasant to be the recipient of a scornful "ha". Court fools, presidential aides and corporate administrative assistants learn early in their careers that it is safer to laugh with the boss than at him or her. Plato and Aristotle correctly feared the power of laughter to undermine authority and lead to the overthrow of the state. Then, as now, politicians' days are numbered when they become regular fare in comedy.

In our politically correct, feel-good, be-happy time we are shielded from – and underestimate – the dark side of laughter that was better known to the ancients. If you think laughter is benign, be aware that laughter is present during the worst atrocities, from murder, rape and pillage in antiquity to the present. Laughter has been present at the entertainments of public executions and torture. On street corners around the world, laughing at the wrong person or at the wrong time can get you killed. The publication of cartoons of the prophet Muhammad by a Danish newspaper triggered calls for the death of the cartoonists and a worldwide murderous rampage that left many dead and injured. Although radical Islam is most in the news, all monotheistic religions ruthlessly suppress humorous challenges to their spiritual franchise. The killers at Columbine High School in Littleton, Colorado, were laughing as they strolled through classrooms murdering their classmates. Laughter accompanies ethnic violence and insult, from Kosovo to Abu Ghraib prison in Iraq.

Laughing with brings the pleasure of acceptance, in-group feeling, and bonding. But laughing at is jeering and ridicule, targeting outsiders who look or act differently, pounding down the nail that sticks up, shaping them up, or driving them away. Being laughed at can be a very serious, even dangerous business.

Laughter is a rich source of information about complex social relationships, if you know where to look. Learning to "read" laughter is particularly valuable because laughter is involuntary and hard to fake, providing an uncensored, honest account about what people really think about each other, and you.

Laughter is a decidedly social signal, not an egocentric expression of emotion. The social context of laughter was established by 72 student volunteers in my classes, who recorded their own laughter, its time of occurrence and social circumstance in small notebooks (laugh logs) during a one-week period. Smiling and talking were also recorded to provide contrasts with laughter and with each other. The presence of media (television, radio, reading material, etc) was noted because it serves as vicarious social stimulation. The sociality of laughter was striking. My logbook keepers laughed about 30 times more when they were around others than when they were alone – laughter almost disappeared among solitary subjects not exposed to media stimulation.

People are much more likely to smile or talk to themselves than they are to laugh when they are alone. Although we probably laugh or smile more when we are happy than sad, these acts are performed primarily in response to face-to-face encounters. You are least likely to laugh, smile or talk immediately before bedtime and after waking, circumstances with reduced opportunities for social interaction. These data provide solid grounds for a behavioural prescription: if you want more laughter in your life, spend more time with other people. If no friends are physically present, you can dial them up on your phone. Even solitary television viewing may not be as socially impoverished as suggested by its detractors, and has something to offer the recluse: the people in the box.

Further clues about the social context of laughter came from the surreptitious observation of 1,200 instances of conversational laughter by anonymous people in public places. My colleagues and I noted the gender of the speaker and audience (listener), whether the speaker or the audience laughed, and what was said immediately before laughter occurred.

Contrary to expectation, most conversational laughter was not a response to jokes or humorous stories. Fewer than 20% of pre-laugh comments were remotely joke-like or humorous. Most laughter followed banal remarks such as "Look, it's Andre", "Are you sure?" and "It was nice meeting you too". Even our "greatest hits" – the funniest of the 1,200 pre-laugh comments – were not necessarily howlers: "You don't have to drink, just buy us drinks", "She's got a sex disorder – she doesn't like sex", and "Do you date within your species?" Your life is filled with a laugh track to what must be the world's worst situation comedy. Mutual playfulness, in-group feeling and positive emotional tone – not comedy – mark the social settings of most naturally occurring laughter. Laughter is more about relationships than humour.

Another counterintuitive discovery was that the average speaker laughs about 46% more often than the audience. This contrasts with the scenario of stand-up comedy in which a non-laughing speaker presents jokes to a laughing audience. Comedy performance proves an inadequate model for everyday conversational laughter. Analyses that focus only on audience behaviour (a common approach) are obviously limited because they neglect the social nature of the laughing relationship.

The story became more provocative when we identified the gender of participants in laughing relationships. Gender determines the proportion of speaker and audience laughter. Whether they are speaker or audience (in mixed-sex groups), women laugh more often than men. In our sample of 1,200 cases, female speakers laughed 127% more than their male audience. Neither males nor females laugh as much with female speakers as they do with male speakers, helping to explain the paucity of female comedians.

On average, men are the best laugh getters. These differences are already present by the time joking first appears, around six years of age. Based on this evidence, it is no surprise that your school clown was probably a male, a worldwide pattern. Laughter is sexy. Women laughing at men are responding to more than their prowess in comedy. Women are attracted to men who make them laugh (ie, "have a good sense of humour"), and men like women who laugh in their presence.

The next time you are at a party, use laughter as a guide to what people really feel about each other – and you. Laughter is a particularly informative measure of relationships because it is largely unplanned, uncensored and hard to fake. Men and women mindlessly and predictably act out our species' biological script. A man surrounded by attentive, laughing females is obviously doing something right, and he will comply by continuing to feed his admirers whatever triggers their laughter. Such good-humoured fellows don't need a big supply of jokes – their charisma carries the day. Laughter is not, however, a win-win signal for males and females; if it is used carelessly, you can laugh your way out of a relationship or a job.

The asymmetrical power of laughter and comedy for men and women is noted by comedian Susan Prekel, who bemoans that men in her audience will "find me repulsive, at least as a sexual being". In contrast, "male comics do very well with women".

Personal ads provide a direct approach to the value of laughter, because people spell out their virtues and desires in black and white. Laughter and humour are highly valued in the sexual marketplace. In 3,745 personal ads published by heterosexual males and females in eight US national newspapers on 28 April 1996, men offered "sense of humour" (or "humorous") and women requested it. Women couldn't care less whether their ideal male partner laughs or not – they want a male who makes them laugh. Women sought humour more than twice as often as they offered it. The behavioural economics of such bids and offers is consistent with the finding that men are attracted to women who laugh in their presence. Without such a balance between bids and offers, there would be no market for laughter and humour, and the currency of these behaviours would decline.

Amazingly, we somehow navigate society, laughing at just the right times, while not consciously knowing what we are doing. Consider the placement of laughter in the speech stream. Laughter does not occur randomly. In our sample of 1,200 laughter episodes, the speaker and the audience seldom interrupted the phrase structure of speech with a ha-ha. Thus, a speaker may say "You are wearing that? Ha-ha," but rarely "You are wearing… ha-ha… that?" The occurrence of laughter during pauses, at the end of phrases, and before and after statements and questions suggests that a lawful and probably neurologically based process governs the placement of laughter in speech. Speech is dominant over laughter because it has priority access to the single vocalisation channel, and laughter does not violate the integrity of phrase structure.

The relationship between laughter and speech is akin to punctuation in written communication. I call it the punctuation effect. The orderliness of the punctuation effect is striking because it's involuntary (we cannot laugh on command). If punctuation of speech by laughter seems unlikely, consider that breathing and coughing also punctuate speech. Better yet, test the proposition of punctuation by examining the placement of laughter in conversation around you, focusing on the placement of ha-ha laughs.

It's a good thing that time sharing by these airway manoeuvres is neurologically orchestrated. How complicated would our lives be if we had to plan when to breathe, talk and laugh.