How does the bike act under:
- Load?
- Idle in neutral?
- Idle in gear?
- Higher revs in gear with the clutch engaged fully (partial load)?
- Under acelaration?
- Various levels of revs - both reving up and down quickly, slowly and at constant rev level?
- With or without choke - if it has one?
- How does the engine act if left off for a good while before starting up, and how long does it take before it actis up? I.e. does it act up quicker if you start it up shortly after it having acted up than if it for instance was left over night?
For the engine to work it needs:- Air
- Fuel
- Compression
- Spark
- Correct timing
The symptoms you describe can be caused by faults of any of the things listed above, but some culprits are more likely than others. Unless the problem has crept up on you over time, and you have not turned a wrench on it, and you can't see or feel a leak from the top, the exhaust headers, the fuel line, etc - you can likely rule out compression (but it is simple to measure).
I doubt that there is something wrong with the neutral switch that causes this, but there could be something wrong with the side stand switch or the kill switch that might act up under some sort of vibration, angle or contact from turning the handle bars, operating levers, etc. Having something wrong with the side stand circuit is quite common.
It is also unlikely that the problem is lack of air. Your air filter would have to be completely clogged up or soaked in order for the bike to not run at all.
Another possible culprit is the CDI - but then again, one would expect that it would work intermittently (i.e. under different temperatures, voltages [revs] or humidity levels... or not at all). I would not expect it to cut simply because one puts the bike into gear - but it isn't entirely possible.
If for instance it takes longer for the bike to cut out after having been left for hours, it is easy to think that it has to do with temperature where as it may be more likely that his has to do with fuel supply. It might for instance be a case where the fuel doesn't flow freely from the tank, through the lines, the pump and the carburetor. When left for a while, enough fuel might accumulate for the bike to run for a while, at least under very light load. Conversely, you might have a problem with the bike flooding - though it doesn't sound to me like this is your issue. It might also be that your spark plug is fouling, that your spark plug lead is corroded or broken, and a heap of other potential culprits.
I would start with the easiest things first. At the very first I would check if you have vacuum in the tank. Some tanks have a breather hose, others have a breather hole in the fuel cap. If blocked, vacuum will slowly accumulate with the engine running, and slowly dissipate with the engine off. Under load or high revs, the engine will bog down after running for a while, or completely cut out as soon as you increase revs or put the engine under load. Simply unscrew the fuel cap and see if the problem persists - if it doesn't, you have found your problem - and then need to check the breather hole or hose. If the problem persists - then go to the next step.
Next I would start with doing a visual inspection, looking for any leaks under load (fuel, oil, exhaust, coolant, etc) - i.e. cover the exhaust outlet, etc. I would then check for potential problems with the sidestand and the kill switch, wiggling cables etc with the engine running. If your problem occurs only with a hot engine, check that the fuel lines are not in direct contact with the engine block, etc - causing vapor lock.
Next, if easily accessible, I would do the same with the spark plug lead and cap. Next I would follow up by checking the plug (gap, fouling, spark). With the spark plug out, I would also take the opportunity to measure the compression (write down the number for future reference, and do so every time you check or change your plug in the future - it will help you tell the condition of your engine as it ages).
Next after that I would start checking the flow of fuel (engine off) - starting at the end closest to the engine - i.e.the fuel filter (including any inline), followed by opening up the carburetor and check the float and needle and flow of fuel, disconnect the fuel line to see if the fuel runs, etc. With the fuel carburetor open, I would give it a good clean. If the fuel doesn't flow, then check all the way up to the tank.
Next I would measure the juice coming out of the alternator and the condition of your battery.
Next I would check the CDI (best tested by swapping it).
Next I would check the fuel pump.
If it is time to service the bike, you might as well change all your filters as well.