Also why do you need a new election to reinforce a mandate? How does that work? And did Theresa May not run for re-election when she was the one who called for the election or was Boris Johnson chosen instead of her as the lead candidate since they are from the same party?
In Theresa May's case, she prematurely called for an election before the end of the 5 year term because of internal pressure she was facing from pro-Brexit factions within the Tory party (she was a remainer). I suppose it was her way of signalling she had a symbolic mandate going forward if successful. It slightly backfired though as the Tories had ended up losing their majority and had to go into coalition with the DUP.
Easier to explain it in the form of a timeline starting from 2010:
2010 - General election leads to a hung parliament (no party has crossed the threshold needed in terms of seats won to form a majority). The Tories, led by David Cameron, win the most seats and go into coalition with the Liberal Democrats, then led by Nick Clegg. Cameron is PM, Nick Clegg is Deputy PM.
2015 - After the maximum 5 year term has passed, a general election is called. The Tories this time manage to secure an outright majority, and Cameron remains as PM, the Lib Dems are practically wiped out in this election. During the campaign, Cameron pledged he would hold a Referendum within a year on staying in the EU. Cameron himself is a remainer, and wanted to ward off pressure he was getting from eurosceptics in his party, so gambled on this being an opportunity to quash internal party squabbles.
2016 - Brexit referendum is held, and the UK votes marginally in favour of leaving the EU. Cameron subsequently resigns, and the Tories carry out a process to select the next party leader and hence the PM (In the UK parliamentary system, the leader of governing party is the PM by convention, its not a directly elected position as with presidential systems). The Tories select Theresa May as their leader who subsequently becomes Prime Minister. Note by this point its been a year since the last general election, so Theresa May isn't obliged to call an election for another 4 years.
2017 - Theresa May calls an election well before the maximum term limit (2020), as a gamble to ward off pressure she was facing with the most ardent Brexiteers in the party, essentially trying to reinforce her
perceived mandate. The Election backfires since the Tories lose their delicate majority, and instead have to go into a coalition with the DUP.
2019 - After repeatedly failing to convince passing her proposed Brexit withdrawal agreement, Theresa May resigns. The Party then selects Boris Johnson to become leader and hence PM. Johnson shortly after calls a snap election after being sworn as PM, namely because he himself couldn't pass a revised withdrawal agreement.
2019 - Tories reclaim an outright majority in the election, Boris continues as PM, now with a stronger mandate.
2020 - Britain officially leaves the EU.
2022 - Following a series of scandals, Johnson resigns as PM. The Tory party selects Truss to be new leader and PM.
- few months later, Truss speedruns tanking the economy with a disastrous mini budget, and fails to outlive a lettuce as she resigns in shame. Rishi Sunak becomes the new leader and PM.
2024 - Its now 5 years since the last general election, so Sunak is obliged to call an election within the year. He selects July 4th as the date. Tories get wiped out, Labour secures a landslide majority, and their leader Keir Starmer becomes PM.