The ignition system is designed to send electrical current from the battery and to the spark plugs that your engine uses in a quick burst, enough to supply the starting combustion and keep the engine operating. The wiring used to carry the current can short out and fail. This can lead to rough starts that eventually end in a refusal to start altogether. Failed wiring can be tested with an ohmmeter to see if it still works.
The problem might also be the battery your mower uses to supply the charge. If you are having to hold the ignition on for longer and longer periods of time, the battery might be having trouble creating the necessary charge and might need to be replaced. You also can take the battery out and look for signs of dirt or corrosion that might be affecting its performance.
The battery is not the only part of your electrical system that can be affected by corrosion. Your starter assembly and solenoid that starts the ignition process also can become corroded. The connectors that your battery uses might have similar problems, leading to total ignition failure. You can solve this problem by cleaning all your connections and checking for corrosion that might indicate replacement parts are needed.
If your start-up process is intermittent and unpredictable, you might have a problem with your spark plug. Spark plugs can fail or become corroded or be improperly gapped. You might need to adjust the spark plug or replace it to fix the problem. The problem also could be a spark plug that creates a spark at the wrong time in the cycle so the fuel never combusts, which requires replacing the shear key or magneto to fix the issue.