The Sociology of Knowledge is the study of the relationship between human thought and the social context within which it arises, and of the effects prevailing ideas have on societies. (Compare history of ideas.)
The term first came into widespread use in the 1920s, when a number of German-speaking sociologists, most notably Max Scheler, and Karl Mannheim, wrote extensively on it. With the dominance of functionalism through the middle years of the 20th century, the sociology of knowledge tended to remain on the periphery of mainstream sociological thought. It was largely reinvented and applied much more closely to everyday life in the 1960s, particularly by Peter L. Berger and Thomas Luckmann in The Social Construction of Reality (1966) and is still central for methods dealing with qualitative understanding of human society (compare socially constructed reality).
Although very influential within modern sociology, the sociology of knowledge can claim its most significant impact on science more generally through its contribution to debate and understanding of the nature of science itself, most notably through the work of Thomas Kuhn in The Structure of Scientific Revolutions (see also: paradigm).
Phenomenological Sociology is the study of the formal structures of concrete social existence as made available in and through the analytical description of acts of intentional consciousness. The "object" of such an analysis is the meaningful lived world of everyday life: the "Lebenswelt", or Life-world (Husserl:1989). The task, like that of every other phenomenological investigation, is to describe the formal structures of this object of investigation in subjective terms, as an object-constituted-in-and-for-consciousness (Gurwitsch:1964). That which makes such a description different from the "naive" subjective descriptions of the man in the street, or those of the traditional, positivist social scientist, is the utilization of phenomenological methods.
The leading proponent of Phenomenological Sociology was Alfred Schutz [1899-1959]. Schutz sought to provide a critical philosophical foundation for Max Weber's interpretive sociology through the use of phenomenological methods derived from the transcendental phenomenological investigations of Edmund Husserl [1859-1938]. Husserl's work was directed at establishing the formal structures of intentional consciousness. Schutz's work was directed at establishing the formal structures of the Life-world (Schutz:1980). Husserl's work was conducted as a transcendental phenomenology of consciousness. Schutz's work was conducted as a mundane phenomenology of the Life-world (Natanson:1974). The difference in their research projects lies at the level of analysis, the objects taken as topics of study, and the type of phenomenological reduction that is employed for the purposes of analysis.
Ultimately, the two projects should be seen as complementary, with the structures of the latter dependent on the structures of the former. That is, valid phenomenological descriptions of the formal structures of the Life-world should be wholly consistent with the descriptions of the formal structures of intentional consciousness. It is from the latter that the former derives its validity and truth value (Sokolowski:2000).
The phenomenological tie-in with the sociology of knowledge stems from two key historical sources for Mannheim's analyses:  Mannheim was dependent on insights derived from Husserl's phenomenological investigations, especially the theory of meaning as found in Husserl's Logical Investigations of 1900/1901 (Husserl:2000), in the formulation of his central methodological work: "On The Interpretation of Weltanschauung" (Mannheim:1993:see fn41 & fn43) - this essay forms the centerpiece for Mannheim's method of historical understanding and is central to his conception of the sociology of knowledge as a research program; and  The concept of "Weltanschauung" employed by Mannheim has its origins in the hermeneutic philosophy of Wilhelm Dilthey, who relied on Husserl's theory of meaning (above) for his methodological specification of the interpretive act (Mannheim: 1993: see fn38).
It is also noteworthy that Husserl's analysis of the formal structures of consciousness, and Schutz's analysis of the formal structures of the Life-world are specifically intended to establish the foundations, in consciousness, for the understanding and interpretation of a social world which is subject to cultural and historical change. The phenomenological position is that although the facticity of the social world may be culturally and historically relative, the formal structures of consciousness, and the processes by which we come to know and understand this facticity, are not. That is, the understanding of any actual social world is unavoidably dependent on understanding the structures and processes of consciousness that found, and constitute, any possible social world.
Alternately, if the facticity of the social world and the structures of consciousness prove to be culturally and historically relative, then we are at an impasse in regard to any meaningful scientific understanding of the social world which is not subjective (as opposed to being objective and grounded in nature [positivism], or intersubjective and grounded in the structures of consciousness [phenomenology]), and relative to the cultural and ideational formations of particular concrete individuals living in a particular socio-historical group.
In The Birth of the Clinic: An Archeology of Medical Perception, 1963, Foucault extended his critique to all of modern scientific medicine, arguing for the central conceptual metaphor of "The Gaze", which had implications for medical education, prison design, and the carceral state as understood today. Concepts of criminal justice and its intersection with medicine were better developed in this work than in Szasz and others, who confined their critique to current psychiatric practice.
Finally, in The Order of Things, 1966, and The Archeology of Knowledge, 1969, Foucault introduced the abstract notions of mathesis and taxonomia. These, he claimed, had transformed 17th and 18th century studies of "general grammar" into modern "linguistics", "natural history" into modern "biology", and "analysis of wealth" into modern "economics". Not, claimed Foucault, without loss of meaning. The 19th century had transformed what knowledge was.
Perhaps Foucault's best-known and most controversial claim was that before the 18th century, "Man did not exist". The notions of humanity and of humanism were inventions or creations of this 19th century transformation. Accordingly, a cognitive bias had been introduced unwittingly into science, by over-trusting the individual doctor or scientist's ability to see and state things objectively. This study still guides the sociology of knowledge and has been claimed to have sparked single-handedly much of postmodernism.
Studies of mathematical practice and quasi-empiricism in mathematics are also rightly part of the sociology of knowledge, since they focus on the community of those who practice mathematics and their common assumptions. Since Eugene Wigner raised the issue in 1960 and Hilary Putnam made it more rigorous in 1975, the question of why fields such as physics and mathematics should agree so well has been debated. Proposed solutions point out that the fundamental constituents of mathematical thought, space, form-structure, and number-proportion are also the fundamental constituents of physics. It is also worthwhile to note that physics is nothing but a modeling of reality, and seeing causal relationships governing repeatable observed phenomena, and much of mathematics, especially in relation to the growth of the calculus, has been developed precisely for the goal of developing these models in a rigorous fashion. Another approach is to suggest that there is no deep problem, that the division of human scientific thinking through using words such as 'mathematics' and 'physics' is only useful in their practical everyday function to categorify and distinguish.
Fundamental contributions to the sociology of mathematical knowledge have been made by Sal Restivo and David Bloor. Restivo draws upon the work of scholars such as Oswald Spengler (The Decline of the West, 1926), Raymond L. Wilder and Lesley A. White, as well as contemporary sociologists of knowledge and science studies scholars. David Bloor draws upon Ludwig Wittgenstein and other contemporary thinkers. They both claim that mathematical knowledge is socially constructed and has irreducible contingent and historical factors woven into it. More recently Paul Ernest has proposed a social constructivist account of mathematical knowledge, drawing on the works of both of these sociologists.