Gasoline powered lawnmowers are pretty dependable, but can develop problems. It can be frustrating if a mower starts, then dies after running a few seconds. Fortunately, a homeowner can troubleshoot, diagnose and fix most of the problems which cause this. Troubleshooting should start with an owner's manual, which usually will have instructions for a specific brand. Most mower engines, however, are similar and have the same basic troubleshooting routines.
The most common cause of a mower failing to keep running is a clogged air filter. Take the cover off the air filter compartment and remove the filter to see if it is dirty, or clogged with oil and dust. If it is a foam rubber filter, wash it in warm soapy water, let it air dry, soak it with a teaspoon of motor oil and replace it. If it will not wash clean, buy a new one. If it is a dirty paper filter, buy a new one; these cannot be cleaned.
A dirty carburetor is the next most common problem with a balky engine. While the air filter is out, examine the carburetor. If it is dirty, spray it with an automotive carburetor cleaner. Spray into the bowl of the carburetor and outside, to clean the throttle and choke cables. If those are dirty and fouled with grease and grime they will not operate properly.
Check the fuel. Gasoline can deteriorate in an engine, especially if it has been sitting for a while. If there is any question about the fuel, drain the tank and refill it with freshly-purchased gasoline; don't fill it from the same stored tank. Put drained gasoline into your truck or car; it will mix with regular fuel and burn all right.
Examine the muffler to make sure it is not clogged with dirt. An engine must exhaust gas fumes to keep running. As a final step, look under the mower deck to be sure wet clippings and lawn debris are not blocking the blade from turning freely. Remove any clogged material; wash the underside with a hose if it is very dirty.