Party sought to hold on to 58 seats but lost 24 in by-elections, a ‘drastic’ decline, analysis shows