1. Make sure the system is turned off, consider removing the battery pack
2. Consider putting the bike in a stand or flip it upside down (onto the seat and bars)
3. Use scissors or other cutting tool to snip any zip ties, disconnect the motor cable
4. Shift down to the lowest gear (this makes removing the wheel easier)
5. Use a wrench (15 mm in this video) to loosen the bolts on the rear wheel, this bicycle had a 40 Nm torque rating 9~30 Torque Pounds) and torque wrenches might be useful for this
6. Once the bolts are loosened you can pull the derailleur down and out of the way
7. If the tire isn’t flat, you may need to take out excess air (this would be the case if you’re swapping tires), also take out a retaining nut if your stem is threaded like in the video
8. Massage the tire and prepare to remove it using tire levers, plastic levers won’t damage the tube, tire or rims as easily as metal tools might. Slide the lever all the way around to get one side of the tire completely free, you often do not need to remove the tire if you’re just patching a tube or replacing it. Most tires are rated 2,000 miles (3,000 kilometers) before needing replacement.
9. When reinstalling the wheel, if your bike has a hub motor be sure to index the dropout with the motor cable and alignment nut so that the motor will spin the same direction and no cables will be twisted or sheered. Sometimes the metal bump that lines up with the dropout acts as a small torque arm to provide something for the motor to push against.
10. Make sure the brakes are aligned and that the axle is completely seated before tightening things down.
11. To avoid flats you can get Kevlar lined tires and thicker tubes, there are also liners and sealent that can be added to some wheel setups to increase durability.