Every rider gets a puncture sooner or later. To fix a flat tyre you need two tyre levers, a spare tube and a pump. With practice it takes five minutes at the roadside.
Remove the wheel and the tube
Open the brake, release the wheel and let out any air that is left. Then hook a lever under the tyre bead and slide it around the rim.
Find the cause
Run your fingers carefully around the inside of the tyre. If you skip this step, the new tube will puncture on the same thorn.