I was thinking after the most recent Game of Thrones episode - it was clear that Tyrion was going to be found guilty anyway according to Tywin's plan. He drove Jaime into making the deal he was planning to make all along, which in turn would make Tyrion to plead for mercy (as it was Jaime who was asking Tyrion to do that).
In my opinion the single thing that drove Tyrion over the edge and ruined the Tywin's plan (to send Tyrion to the Wall and make Jaime produce offsprings to continue the family line) was Shae's testimony to the court. I can't possibly believe that Tywin was not aware of the list of witnesses and of the effect Shae's appearance and words might have on Tyrion.
So the question is - why did he allow her to testify? Just to humiliate Tyrion even more? Why did he not consider the possibility that her appearance might enrage Tyrion and drive him to demand the trial by combat thus ruining the initial plan?