How were the first, second and third laws of thermodynamics discovered?
The second law was formulated in the quests of finding the perfect thermodynamic engine where it was realised that complete conversion of heat to work is not possible. This happened due to the works of Carnot, Clausius and others, Clausius being the most significant contributer.
The third law came up on the quests to attain the absolute zero temperature. That's when people realized that attaining that temperature is impossible and the third law in mathematical form came out from Nerst's heat theorem.