1. Faulty ignition switch or loose wire. Check that all wires are properly connected to the switch. Ignition could be bad. Replace it.
2. Ground wire not connected to magneto. This happens only if you have tried to work on the engine and removed this wire. Re-connect the black wire to its spade connector on the bottom side of the magneto.
3. Ground wire is broken, not properly installed or disconnected to stop switch. Make sure the wire is properly fitted in its connector on the control bracket (horizontal B&S, vertical and horizontal Tecumseh) or connected to the brake band, brake pad mechanism (vertical B&S, vertical Tecumseh.)