Intermittant electrical faults are always the worst to pin down
Possible culprits (in no particular order) ...
Ignition switch, Kill switch, ignition relay, starter relay (solenoid), side stand cut-out or alarm/immobiliser if fitted.
Other possibilities...
Loose or corroded connectors, battery leads or breaks in wiring loom
S4's don't like limp batteries and ECU shuts up shop if the voltage drops too low killing the sparks, but you seem to have that covered with the new replacement and optimate.
Theres always the possibility the pump itself could be duff, but I've not heard of many going wrong? My own money would be on the main ignition relay - a £5.00 item that often packs up on monsters of all types. If you have a wiring diagram you should be able to find it, or failing that turn the ignition on/off with tank up and you should hear relay clicking as fuel pump kicks in.