The classical theory of groupthink was developed by Irving Janis in the early '70s, largely based on his analysis of the Bay of Pigs fiasco, the Cuban Missle Crisis, and the Vietnam War.  He considered groupthink a mode of thought that arises in highly cohesive groups when their desire for a unanimous decisions trumps their willingness to question the dominant point-of-view. In his model, good decisions require debate and dissenting opinions, two things that are often at odds with harmonious group interactions.
Janis' work ignited a firestorm of research that established groupthink as a cornerstone of social psychology, but subsequent research has found relatively little support for Janis' explanation of the phenomenon. In particular, Park's sweeping meta-analysis of past research showed that group cohesion and premature consensus had little to do with the quality of group outcomes.  There is little doubt that groupthink happens, but classical theories do not adequately explain why or how.
Part of the problem is that Janis' model relies on a collection of vague constructs that are difficult to measure: group cohesion, illusions of unanimity, belief in moral superiority, etc. Enter Glen Whyte, who has suggested a new model of groupthink that rests upon a solid foundation of empirical research.
Whyte's narrative goes something like this: A group of decision-makers enjoy some early successes and develops an exaggerated sense of their own competence. Eventually, they encounter a situation that's beyond their actual abilities and end up in over their heads. When they finally realize their predicament, they percieve any corrective action as a choice between losses (relative to the unreasonably positive outcome they originally anticipated). When faced with a choice between losses, people tend to favor riskier courses of action. Thus, the group not only fails to correct their error, they actively choose to make it worse. 
The first link in this chain is a process called group polarization. Since the 1960's, researchers have found that discussion tends to skew the average opinion of a group towards that of its most extreme member.  Prejudiced groups become more prejudiced, radicals become more radical, and so forth. In this case, members of a group that has demonstrated competence in the past tend to polarize towards an exaggerated sense of their own abilities.
The second link is a phenomenon known as Framing. Again, study after
study demonstrates that the way you word a choice or question has a
poweful impact on how people respond. In this instance, framing
something as a choice between two losses tends to make people pick the
riskiest option. Take this example from Tversky & Kahneman's
Imagine that the United States is preparing for the outbreak of an unusual disease, which is expected to kil 600 people. Two alternative programs to combat the disease have been proposed. Assume that exact scientific estimate of the consequences of the programs are as follows:
- If Program A is adopted, 200 will be saved.
- If Program B is adopted, there is a 1/3 probability that 600 people will be saved, and a 2/3 probability that no people will be saved.
Which of the two programs would you favor?
Now, consider the same scenario and select between the following two programs:
- If Program C is adopted, 400 people will die.
- If Program D is adopted, there is a 1/3 probability that no one will die, and a 2/3 probability that 600 people will die.
Which of those two programs would you favor?
Though these scenarios are mathematically identical, the change in wording produces drastically difference responses. When Tversky and Kahneman presented college students with the first set of choices, 72% chose Program A (save 200 people, let 400 people die), while 78% of those who were given the second set of options chose Program D (a 2/3 probability that everyone dies). When phrased as a choice between losses (i.e. numbers of people who will die), students chose to roll the dice on a program with a 66% chance of total failure!
In Whyte's scenario, the overconfident decision-makers enter an ill-fated situation with expectations that exceed all reasonable outcomes. Once things head south, they're stuck comparing their new options with those original expectations. In Vietnam, for instance, American leaders expected a decisive victory against Communism. As the war dragged on, they were faced with a choice between cutting their losses or escalating the conflict. They chose the riskier option and paid for it.
There is already experimental evidence that computer-mediated communication accelerates group polarization, particularly under conditions of anonymity.  That puts most online communities in particular danger of groupthink. (See also my article on Anonymity and Antisocial Behavior.)
Interesting Aside: By using group polarization to explain excessive risk-taking in groups, Whyte has brought the concept full-circle. The researcher who discovered it originally named the phenomenon "risky shift," because he was studying groups of decision-makers. Subsequent research showed it to be applicable to a much broader range of group interactions, so the name was generalized.
- Janis, I. (1982). Groupthink, 2nd ed. Boston: Houghton-Mifflin
- Park, W. (2000). "A comprehensive empirical investigation of relationships among variables of the groupthink model." Journal of Organizational Behavior, vol 21(8), 873-887.
- Whyte, G. (1998). "Recasting Janis' Groupthink Model." Organizational Behavior and Human Decision Processes, vol 73(2/3), 185-209.
- Isenberg, D. J. (1986) "Group Polarization: A Critical Review and Meta-Analysis." Journal of Personally and Social Psychology. Vol. 50(6), 1141-1151.
- Tversky, A. & Kahneman, D. (1981). "The framing of decisions and the psychology of choice." Science, vol 211, 453-458.
- Sia, C. L., Tan, B. C. Y. and Wei, K. K. (2002). "Group Polarization and Computer-Mediated Communication: Effects of Communication Cues, Social Presence, and Anonymity." Information Systems Research, vol 13(1), 70-90.