The Gemara (also transliterated Gemarah, or in Ashkenazi pronunciation Gemore; from Aramaic ?, from the Hebrew verb gamar, to finish or complete) is the component of the Talmud comprising rabbinical analysis of and commentary on the Mishnah. At first, Gemara was only spoken of in oral terms and was forbidden to be written down, however after the Mishnah was published by Judah the Prince (c. 200 CE), the work was studied exhaustively by generation after generation of rabbis in Babylonia and the Land of Israel. Their discussions were written down in a series of books that became the Gemara, which when combined with the Mishnah constituted the Talmud.
There are two versions of the Gemara. The Jerusalem Talmud (Talmud Yerushalmi) or Palestinian Talmud was compiled by Jewish scholars of the Land of Israel, primarily of the academies of Tiberias and Caesarea, and was published between about 350-400 CE. The Talmud Bavli (Babylonian Talmud) was published about 500 CE by scholars of Babylonia, primarily of the academies of Sura, Pumbedita, and Nehardea. By convention, a reference to the "Gemara" or "Talmud," without further qualification, refers to the Babylonian version. The main compilers were Ravina and Rav Ashi.
There are six groups of Gemara, namely Zeraim, Moed, Nashim, Nezikin, Kodshim and Taharot. There is a custom made in 1923 by Polish rabbi Meir Shapiro, who saw that there were parts of the Gemara that would never get read, so he started an initiative called Daf Yomi, where people learn a page of Gemara everyday for seven years in order that the entire Gemara would be learned.
The Gemara and the Mishnah together make up the Talmud. The Talmud thus comprises two components: the Mishnah - the core text; and the Gemara - analysis and commentary which "completes" the Talmud (see Structure of the Talmud). Maimonides describes the Gemara component as:
understanding and conceptualizing the ultimate derivation of a concept from its roots, inferring one concept from another and comparing concepts, understanding [the Law] based on the principles of Torah exegesis, until one appreciates the essence of those principles and how the prohibitions and the other decisions which one received according to the oral tradition (i.e. Mishnah) can be derived using them.... 
The rabbis of the Mishnah are known as Tannaim (sing. Tanna ). The rabbis of the Gemara are referred to as Amoraim (sing. Amora ). The analysis of the Amoraim, recorded as gemara, is thus focused on clarifying the positions, views, and word choice of the Tannaim.
Because there are two Gemaras, as mentioned above, there are in fact two Talmuds: the Jerusalem Talmud (Hebrew: ?, "Talmud Yerushalmi"), and the Babylonian Talmud (Hebrew: ?, "Talmud Bavli"), corresponding to the Jerusalem Gemara and the Babylonian Gemara; both share the same Mishnah. The Gemara is mostly written in Aramaic, the Jerusalem Gemara in Western Aramaic and the Babylonian in Eastern Aramaic, but both contain portions in Hebrew. Sometimes the language changes in the middle of a story.
In a narrow sense, the word gemara refers to the mastery and transmission of existing tradition, as opposed to sevara, which means the deriving of new results by logic. Both activities are represented in the Gemara as a literary work. The term gemara for the activity of study is far older than its use as a description of any text: thus Pirke Avot (Ch.5), a work long preceding the recording of the Talmud, recommends starting Mishnah at the age of 10 and Gemara at the age of 15.
Homiletically, the word gemara (?) spells out the first letters of the words Gabriel, Michael, Raphael and Uriel, the names of the angels that man is protected with when delving into Torah study.
The analysis of the Amoraim is generally focused on clarifying the positions, words and views of the Tannaim. These debates and exchanges form the "building-blocks" of the Gemara; the name for such a passage of Gemara is a sugya (; plural sugyot). A sugya will typically comprise a detailed proof-based elaboration of the Mishna. Every aspect of the Mishnaic text is treated as a subject of close investigation. This analysis is aimed at an exhaustive understanding of the Mishna's full meaning.
In the Talmud, a sugya is presented as a series of responsive hypotheses and questions - with the Talmudic text as a record of each step in the process of reasoning and derivation. The Gemara thus takes the form of a dialectical exchange (by contrast, the Mishnah states concluded legal opinions - and often differences in opinion between the Tannaim. There is little dialogue). The disputants here are termed the makshan (questioner, "one who raises a difficulty") and tartzan (answerer, "one who puts straight").
The Gemara records the semantic disagreements between Tannaim and Amoraim. Some of these debates were actually conducted by the Amoraim, though many of them are hypothetically reconstructed by the Talmud's redactors. (Often imputing a view to an earlier authority as to how he may have answered a question: "This is what Rabbi X could have argued ...") Only rarely are debates formally closed.
The distinctive character of the gemara derives largely from the intricate use of argumentation and debate, described above. In each sugya, either participant may cite scriptural, Mishnaic and Amoraic proof to build a logical support for their respective opinions. The process of deduction required to derive a conclusion from a prooftext is often logically complex and indirect. "Confronted with a statement on any subject, the Talmudic student will proceed to raise a series of questions before he satisfies himself of having understood its full meaning." This analysis is often described as "mathematical" in approach; Adin Steinsaltz makes the analogy of the Amoraim as scientists investigating the Halakha, where the Tanakh, Mishnah, Tosefta and midrash are the phenomena studied.
Prooftexts quoted to corroborate or disprove the respective opinions and theories will include:
The actual debate will usually centre on the following categories:
Why does the Mishna use one word rather than another? If a statement is not clear enough, the Gemara seeks to clarify the Mishna's intention.
Exploring the logical principles underlying the Mishnah's statements, and showing how different understandings of the Mishnah's reasons could lead to differences in their practical application. What underlying principle is entailed in a statement of fact or in a specific instance brought as an illustration? If a statement appears obvious, the Gemara seeks the logical reason for its necessity. It seeks to answer under which circumstances a statement is true, and what qualifications are permissible. All statements are examined for internal consistency. See: List of Talmudic principles and Category:Talmud concepts and terminology
Resolving contradictions, perceived or actual, between different statements in the Mishnah, or between the Mishnah and other traditions; e.g., by stating that: two conflicting sources are dealing with differing circumstances; or that they represent the views of different rabbis. Do certain authorities differ or not? If they do, why do they differ? If a principle is presented as a generalization, the Gemara clarifies how much is included; if an exception, how much is excluded.
Demonstrating how the Mishnah's rulings or disputes derive from interpretations of Biblical texts, the Gemara will often ask where in the Torah the Mishnah derives a particular law. See Talmudic hermeneutics and Oral Torah #The interplay of the Oral and Written Law.