Shae betrayed Tyrion because she was never loyal to him, only to his money. When she got a chance to be with Tyrion's father, Tywin, she took the opportunity and defected to side with Cersei, who offered her enough money to lie against Tyrion. She was just another selfish and opportunistic person who did not care for anyone but herself.