An Outline of the History of Restriction on Ijtihad
If you say: How is it that after two hundred years it became obligatory to follow a particular madhhab while it was not so earlier?
I will reply: That which is actually obligatory is that there be in the Ummah someone who knows all the ahkam for the sake of their observance, and the prerequisite of an obligation is also obligatory. Therefore, if there exist numerous ways of meeting an obligation, anyone of them may be chosen, but if all ways except one are closed that one becomes specifically binding. 
[The Gist of Shah Wall Allah's Observations:]
In my view the gist of his elaborate discussion consists of two claims:
The First Claim: During the first two centuries it sufficed to refer to any mujtahid, but after this period when there existed the imams of the madhdahib who were independent mujtahids, it became obligatory to refer to anyone among them specifically. When one asks the reason for this distinction and the cause for something becoming obligatory which was not so earlier, he gives a reply, as already quoted under the title . . . , which is not satisfactory, unless he implies by it what we shall mention shortly along with its reply.
The Second Claim: This concerns the closure of the door of ijtihad from the beginning of the 4th/10th century, making it obligatory upon all Muslims up to the present to refer to affiliated mujtahids. Here he is content to claim that the conditions for independent ijihad ceased to exist from that time onwards. But this amounts to begging the question, especially as this claim disregards figures of major eminence who lived during this period and whose scholarly books and writings testify to their having attained the highest levels of ijtihad.
In any case, he does not mention in his book al-Insaf the official decree restricting the madhahib to four and making it binding to refer specifically to them to the exclusion of others. Although he raises the issue of the restriction in his book 'Iqd al-jid fi ahkam al-ijtihad wa al-taqlid, but there also he does not explicitly mention that it is obligatory to follow the four madhahib. In fact, he appears to imply the preferability of referring to them, for under the chapter entitled "Bab ta'kid al-akhdh bi al-madhahib al-arba'ah wa tark al-khuruj `anha"  (`Chapter Concerning
Emphasis on Referring to the Four madhahib and not Going Beyond Them') he observes:
You should know that there lies a great benefit in adhering to these four madhahib and a great harm in disregarding all of them. We will explain this by giving a number of reasons.
Then he goes on to give reasons which do not substantiate his claim. I shall mention some of them here along with their inadequacies. These are as follows: