I used the special tool to get the gears off the wheel. The special tool was turned by a socket wrench, and I added a four foot pipe to the end of that, for leverage. And that was all needed, it was really stiff.
Once that was off, the freewheel could be taken apart using a hammer and screwdriver, and it was caked inside with either mud, or maybe congealed oil. So I'm leaving it for a while to soak in degreaser, and maybe it will work when that's done. And there's ball bearings; 19 at one end, and 37 at the other, and I think I have them all.
With that done, I thought about the other gear cassette that stopped working in exactly the same way a few years ago. So I dismantled that too, scraped out the gunk from the inside, and it's also sitting overnight in degreaser.
With any luck, I'll have two working gear cassettes. There's no hurry though, because my spare rear wheel is looking good.
I also took the plunge and ordered a replacement back wheel. This uses a freehub instead of a freewheel; the difference is that a freewheel screws onto the wheel with a thread; the freehub is part of the hub, and the cassette slots onto it. The big reason for ordering this one, is that A) it will give me gears from 11 to 28 teeth (now I've got 14 to 28). That means that the same rotation of pedals will get me 30% further. So when I'm whizzing along tarmac and I can't pedal because I can't turn the pedals fast enough, that will help. And B) it uses a quick-release instead of nuts. I'm not expecting to have to use that much, but it does mean that I won't need the very large spanner that I've been carrying just in case I need to fix a puncture problem. Slight weight reduction!
I had another go at the front gears on the bike; I can change from high gear to low, but changing from low to high needs an amount of pressure on the gear changer that's absurd. I oiled the cable, and it does move freely in the outer, but that hasn't fixed the problem. This is one for future thought. I've been doing fine without the front gear changer up till now, so it won't be a great loss. This is because when you'd need the lower gears for going uphill in a normal bike, the motor on my electric bike means that I don't really need such low gears.
Thanks to Jason for helping me dismantling those gears, and with all the other help on the bike!
... later ...
Maybe I need a new front derailleur mechanism? I've ordered one on Ebay.