I had an intermittent starting problem for ages, which would involve backfiring and all sorts of fun and games.Tried loads of things, including changing parts, etc. Same thing, cranking over strongly, battery was in a very good and charged state.
Then the other day it happened again but then when i was riding the engine just cut out. Got it started again soon after but this now gave me a different angle to investigate.
It was then hinted that it could be an ignition switch problem.
A few months ago i'd put a bit of WD40 on my key as the switch felt a bit sticky, but years ago i remember using graphite on the switch to do a similar job.
So apparently, over time the switch can get clogged up with dirt, congealed grease, or basically whatever you've chosen to shove in it over time to give it a bit of a lube. This will then make the contacts intermittent. I reckon rain going down the key hole can move shit about a bit, causing the random misbehaving.
Not feeling overly hopeful, i then drowned the ignition barrel down the key hole in Isopropyl Contact Cleaner spray, using the key as well so it got everywhere possible, and it was an instant revelation.
Bike starts strongly first time on the button now, and even feels better in running as well.
Certainly worth a go, even more so as you have the right spray to hand.