First thing I'd do is charge the battery with a good motorcycle smart charger & do a load test >> even if new. never assume a battery is good. The motorcycle needs a good, fully charged battery to start & run right.
Another problem could be the spark plug wire connections as they become poor from oxidation over time >> I would redo all of the connections. Unscrew the ribbed compression boots at the coils; the plug caps unscrew from the spark plug wires. I would nip off the ends a tad. Or go ahead & get new spark plug wires. You can reuse the o-rings n stuff on the old plug wires where they connect at the stock coils. you can also reuse the stock sheathing.
If the ignition coils are the originals, you may need to replace them. Sometimes they test fine cold, but when they get hot, they fail from internal shorts or something. A simple test is to ride the bike to warm up the engine, preferable doing a high speed run, then stop & feel the coils >> they should be warm, not hot >> press hard with your fingers. Mine were very hot to the touch, so I got green Dyna 3 ohm coils. The grey Dyna 2.2 ohm are probably a better match for the ignition system. There are also Accel coils & some guys install the ignition coil from a Buck Grand National 6-cylinder then adapt the wires (credit to ELR658).
Also, be sure to clean, check & lubricate the timing advancer. Separate the rotor from the advancer body to lubricate it & fill the groove with grease (if yours has the groove). After reassembly, check that the springs are good, not stretched or deformed or anything, then operate the rotor >> it should snap back. I think I used high temp wheel bearing grease the last time I serviced my timing advancer.
1981 KZ650-CSR. Competition, Sports & Road.