What Is Ijma` and What Are Its Types?
Question

I would like to know what ijma` is, and what are its types and conditions?
Praise be to Allah.What is ijma’?
Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) said: 
“In linguistic terms, ijma` means resolve and agreement. 
In Shar‘i terms, ijma` means the agreement of the mujtahids of this ummah after the death of the Prophet (blessings and peace of Allah be upon him) on a shar‘i ruling . 
By saying “agreement” we exclude differences of opinion; if there is a difference of opinion, even from one person, then we cannot say that there is ijma`. 
By saying “the mujtahids” we exclude the common folk and those who follow or imitate scholars; it does not matter whether they agree or disagree. 
By saying “this ummah” we exclude the consensus of others, which carries no weight. 
By saying “after the death of the Prophet (blessings and peace of Allah be upon him)” we exclude their agreement at the time of the Prophet (blessings and peace of Allah be upon him); ijma` or consensus at that time does not count as evidence, because evidence is established by the Sunnah of the Prophet (blessings and peace of Allah be upon him), whether in word or deed or by approval. Hence if a Sahabi says “We used to do” or that they (i.e., people) used to do such and such at the time of the Prophet (blessings and peace of Allah be upon him), this is indicative of the approval of the Prophet (blessings and peace of Allah be upon him), according to consensus. 
By saying “on a shar‘i ruling”, we exclude their agreement on a rational or human ruling, which has nothing to do with the matter under discussion, because we are talking about looking for ijma` as one of the kinds of shar‘i evidence. 
Evidence for the authority of ijma`
Ijma` counts as evidence on the basis of a number of pieces of evidence, including the following: 

The verse in which Allah, may He be exalted, says (interpretation of the meaning): “Thus We have made you (Muslims), a Wasat (just) (and the best) nation, that you be witnesses over mankind” [al-Baqarah 2:143].  The words “witnesses over mankind” include testifying about their deeds and judging their deeds, and the words of the witness may be accepted.
The verse in which Allah, says (interpretation of the meaning): “(And) if you differ in anything amongst yourselves” [an-Nisa 4:59] indicate that whatever they agreed upon is sound and correct.
The Prophet (blessings and peace of Allah be upon him) said: “My ummah will not unanimously agree on misguidance.”
We say: If the ummah unanimously agrees on something, it must be either true or false. If it is true, then it is proof. If it is false, how can this ummah, which is the dearest of nations to Allah since the time of its Prophet until the onset of the Hour, agree on something false with which Allah is not pleased? This is quite impossible.

Types of ijma`  
Ijma` is of two types: definitive and presumptive. 

Definitive is that which is well known and well established, such as consensus that the five daily prayers are obligatory and that zina (fornication, adultery) is haram. No one can deny that this type of ijma` is proven and established, or that it constitutes proof in and of itself, or that the one who rejects it becomes a kafir, unless he is ignorant and may be excused for his ignorance.
Presumptive is that which can only be known by means of research and study, where the scholars may differ as to whether there is ijma` (on a particular issue) or not. The most correct scholarly opinion concerning that is the view of Shaykh al-Islam Ibn Taymiyah, when he said in al-‘Aqidah al-Wasitiyyah: The type of ijma` that is to be accepted is that of the righteous early generations (as-salaf as-salih), because after their time there was a great deal of disagreement and the ummah spread far and wide. End quote.

It should be noted that the ummah cannot agree on something that is contrary to an unabrogated, clear, sahih text, because it can only agree on what is true. If you see consensus that you think is contrary to that, then it must be one of the following: either the evidence is not clear, or it is not sahih, or it is abrogated, or there is a difference of opinion concerning the matter of which you were not aware. 
What are the conditions of ijma`? 
There are certain conditions for ijma`, such as: 

It should be soundly proven in the sense that it is either well known among the scholars or transmitted by a trustworthy narrator who has read widely.
It should not have been preceded by a well-known difference of opinion. If that was the case, then there is no ijma`, because scholarly opinions are not invalidated by the death of their authors.

Ijma` does not cancel out a previous difference of opinion; rather it prevents differences of opinion from arising. 
This is the most correct view, because of the strength of its argument. 
And it was said that the second condition is not stipulated, so it is valid in a later period for there to be consensus on one of the previous opinions and for that to serve as proof for those who come afterwards. 
According to the majority, it is not essential that those who unanimously agree all die when still holding this view for  ijma` to be established; rather ijma` is established as soon as they (the scholars of a particular era) agree, and it is not permissible for them or anyone else to go against it after that, because the condition for the establishment of ijma` do not include any stipulation that the era (of the scholars who reached this consensus) should have come to an end with their passing. As ijma` is established at the moment they agree (on a particular issue), there is nothing that could cancel it out. 
If one of the mujtahids (scholars) says or does something and that becomes well known among the mujtahids, and they do not denounce it even though they are able to do so, then it is said that there is ijma`. It was said that this establishes that there is ijma`; others said that it may be regarded as proof but not ijma`; and others said that it is neither ijma` nor proof. And it was said that if they all passed away before denouncing it then it is ijma`, because their silence until the time of their death, even though they were able to denounce it, constitutes proof of their agreement. This is the view that is most likely to be correct.” (Al-Usul min ‘Ilm al-Usul, 62-64) 
And Allah knows best.