I think she was told of Tywin's plan beforehand. I'm guessing Tywin knew what Shae would say in her testimony— it was all part of his plan to get Tyrion to confess and send him away instead of executing him. Shae knew that Tywin wouldn't kill Tyrion so she went all releasing her pent up anger in form of a scathing…