I think there were several reasons for the decline of UK trolleybuses.
1. Many local authorities used to generate their owm electricity. Costs increased when they had to buy electricity from the former CEGB.
2. Car parking was making it increasingly difficult for trolleybuses to overtake badly parked vehicles.
3. It was expensive to reroute trolleybuses when councils wanted to introduce one way roads & other traffic mismanagement schemes.
As often happens, great god motor car was considered more important than pollution or inconvenience to public transport users.
Also replying to others.
Trolleybuses never became established and were usually a stop gap. Originally also known as railless, legally they were trams without rails rather than electric buses and subject to the same legislation.
Trolleybuses became fashionable following the invention of the pneumatic tyre, giving a smooth ride. Solid tyres over poor road surfaces left much to be desired as illustrated by Rhondda, where the system lasted less than a year. Concern was mounting over damage caused by the trolleybuses, one then crashed into a house and they never ran again.
Many operators of trams were finding their rails were wearing out, and it was easier to replace the trams by trolleybuses. This continued until the outbreak of WW2.
When the war ended, the British public were fed up with years of austerity and wanted a modern world. Public transport was outdated, the car was the future, and suddenly the trolleybus was found to have the same faults of the trams they had replaced.
Post war housing developments would usually be served by motorbuses, as not only was there the legal aspect of extending a trollleybus system, but the requirement that every half mile had to be isolated so a fault at one location would not paralyse he entire system. This required underground cables and cables feeding the overhead every mile.
Ipswich was one such operator which relied on electric transport until taking delivery of its first motorbuses in 1951
London Trannsport had the world's largest trolleybus system which lasted only 31 years. Part of the problem was that trams and subsequentially trolleybuses were never allowed into the City or West End, terminating awkwardly because of this rather than passenger flow. And other operators thought what is good for London is good for us.
The route between Walsall and Wolverhampton was abandoned due to concern of wires being brought down onto the newly extended M6
Four systems lasted into the 1970's - Cardiff (just, also the last 3 axle trolleybuses), Walsall 1970, Tees Side 1971 and finally Bradford 1972
Bradford lasted so long because of its manager CT Humpidge. As other operators were abandoning trolleybuses, Bradford purchased them and is reputed to have said on his transfer to Sheffield "When I left, I made sure they couldn't be abandoned in a hurry"