Walt's hated Lydia pretty much from the beginning. That said, his big plan at the end was to eliminate his loose ends so that his family would 1) be safe and 2) be well off. Lydia not only knew enough to be a threat, but Walt actively knew that she knew who his family was. She even had the audacity to approach Skyler at his cover job, as others have already pointed out. That, coupled with the fact that she was extremely eager to have people killed who were a possible threat to her, was more than enough reason to take her out of the picture. And the cruel, lingering way Walt chose to do it showed just how pissed he was about the approaching-his-family thing. I'm not even sure why his motivations are in contention.