Next time it does it pull the spark plug and see if you have spark.
If I had to guess you have an electrical component overheating that is killing spark when hot, and when it cools off it starts working again. CDI or regulator most likely if you don't have spark when it's hot.
If I had to guess you have an electrical component overheating that is killing spark when hot, and when it cools off it starts working again. CDI or regulator most likely if you don't have spark when it's hot.