UK general election: When and how could it happen?

Despite repeatedly insisting he didn’t want a general election, Johnson has now tried and failed to get parliament to support one. It now looks like he’ll try again or seek a vote by some other route. Having lost his majority and control of parliament, a general election seems almost inevitable now. The big question, though, is when it will happen.
Johnson and his allies would prefer the vote to happen before October 31 – the date the UK is currently due to leave the European Union. Everyone else wants to wait until after that date.