There were two methods of ijtihaad. One was the method of the 'ulamaa' of Iraq, called the way of ra'y {choice} or the way of qiyaas {comparision}: if it was not declared clearly in Qur'aan al-keriim or Hadiith ash-shariif how to do an action, another action that was clearly expressed in Qur'aan al-keriim or Hadiith ash-shariif and which was similar to the action in question would be searched for. When it was found, the action in question would be compared to it and done in a similar way. After the Sahaabat al-kiraam {raziallaahu ta'aalaa anhum}, the leader of the mujtahids of this way was Imaam al-A'zam Abu Haniifa {raziallaahu ta'aalaa anhu}.
The second way was the way of the 'ulamaa' of Hidjaaz, called the way of riwaaya {tradition}. They considered the traditions of the inhabitants of al-Madiinat al-Munawwara superior to qiyaas. The greatest of the mujtahids of this way was Imaam Maalik {raziallaahu ta'aalaa anhu}, who lived in al-Madiinat al-Munawwara. Al-Imaam ash-Shaafi'ii and Imaam Ahmad ibn Hanbal {raziallaahu ta'aalaa anhuma} attended his sohbats. Al-Imaam ash-shaafi'ii, after learning the way of Imaam Maalik, went to Baghdad and learned the way of al-Imaam al-a'zam {raziallaahu ta'aalaa anhu} from his disciples and united these two methods. He established a new approach for ijtihaad. Because he was a very eloquent and literary man, he understood the context of aayats and hadiiths and decided on each action in accordance with an alternative he found more emphatic. When he could not find an alternative strong enough, he himself employed ijtihaad according to the way of qiyaas. Ahmad ibn Hanbal {raziallaahu ta'aalaa anhu} too, went to Baghdad after learning the way of Imaam Maalik {raziallaahu ta'aalaa anhu}. There, he acquired a method of qiyaas from the disciples of al-Imaam al-a'zam {raziallaahu ta'aalaa anhu}. Yet, because he had memorized a great many hadiiths, he employed ijtihaad first by examining the way whereby hadiiths corroborated one another. -- Faizan--e-Syed Aamir Kaleemi Shah