Lawn mower runs for a few seconds then stops
There are so many variables that can keep a small engine from running properly. The best way to find the exact cause of a "no-start" issue is to ensure that the engine has the four necessary things for it to run: fuel, compression, spark and air. If any one is missing or inadequate the engine won't work.   Since it runs, but then stops you can you can assume the plug is igniting the fuel. Check the tank for particles blocking the fuel line, check the gas cap vent for blockage, and clean the air filter. If the gas has been sitting with no Sta-bil preservative the fuel may have crystallized in the carburetor which would mean a disassembly and a soaking in a bath of parts cleaner. Add fresh fuel before re-starting.  Pull the plug and place your thumb over the cool engine plug port. Pull the starting cord on the exhaust stroke the pistons' force should be felt. If not you may need piston rings.