Governments can lose by-elections and still recover, especially if these are in the middle of their term of office.
During Mrs Thatcher’s first two terms of office, Labour won the Darlington by-election in 1983 and the Fulham by-election in 1986 but lost these seats to the Conservative in the general elections that came shortly afterwards.
The same happened when the Conservatives lost Langbaurgh in 1991 but still regained it and won the general election in 1992.
The Conservatives had a poor series of by-elections in 1961 and 1962 but still recovered to almost win the 1964 general election.
It can affect confidence in your party and your leader
A pattern of really poor by-election results can indicate a sea change of opinion and demoralise the Government.
This happened to the Labour Governments of 1966-70 and 1974-9 and the Conservative Government of John Major of 1992-7 when even safe seats were being lost.
In the last two cases the Governments had only small majorities and losing seats meant that managing the House of Commons became more difficult.
Labour was forced to make a deal with the Liberals and Major lost a key vote because his majority was not enough to withstand the rebellion of a small group of anti-EU Conservatives.
It can influence political decisions
A good or a poor performance in a by-election can influence political decisions.
Labour’s gain in the 1933 East Fulham against a Conservative candidate arguing for rearmament convinced the Conservative Prime Minister, Stanley Baldwin, that the public, scarred by the experience of the First World War, was not ready for a major rearmament programme.
A runway Liberal victory in the previously safe Conservative seat of Orpington in 1962 helped to persuade the Prime Minister, Harold Macmillan, to remove his Chancellor of the Exchequer and several other ministers.
The overwhelming UKIP win in Clacton in 2014 pushed David Cameron to adopt a more Eurosceptic position and question the free movement of labour in the EU.
Before opinion polls were so frequent Prime Ministers would use by-election results as an indicator as to whether conditions were favourable to call a general election as Harold Wilson did after Labour’s success in the Hull North by-election in 1966.
Prime Ministers may accept that they will lose some by-elections mid-term and not change policies or the key positions in the Cabinet.
They have also been more reluctant than was the case in the past to appoint MPs to public positions that would lead them to resign from the House of Commons and instead prefer to avoid by-elections.
The seat can be held even when it should really change
An MP elected in a by-election can hold to the seat in succeeding general elections against the national swing.
The Liberal Democrats have been able to do this in a number of places, for example Alan Beith who won the Berwick-upon-Tweed by-election in 1973 remained the MP until his retirement in 2015. Simon Hughes remained for a long time Liberal Democrat MP for Bermondsey. Elected in the 1982 by-election Bermondsey was an area that would normally be safe ground for the Labour Party.
The Conservatives did better in the 2010 by-election in the Crewe and Nantwich seat that they had won in a by-election shortly before, though seats competitive between the two main parties tend eventually to revert to previous patterns of voting.
On the other hand a seat may return to the losing party at the next general election as with Dunfermline and West Fife won by the Liberal Democrats in 2006 and Leicester South which they won in 2004 which both returned to Labour.
They can boost smaller parties
By-elections can create a boost for a smaller party and give it credibility.
The first seat in Parliament can be symbolic, as with the Plaid Cymru gain in the Carmarthen by-election in 1966 and the SNP win in the Hamilton by-election in 1967, and the Clacton –by-election for UKIP in 2014.
The publicity that a by-election creates can help a third party. Although the Liberals did not achieve the startling success in the general elections of 1964 and 1974 that they did in the by-elections shortly before, their by-election victories helped to establish them as a significant alternative to the two larger parties and their vote was considerably increased nationally.
Although by-elections can lead to an increase in support for smaller parties, broader factors are more important. The SNP success in the February 1974 general election was not built on by-election success and UKIP already had significant support, as measured by the opinion polls, before the Clacton by-election.