A starter is essentially a very powerful 12-volt motor that is designed to turn over your car’s engine to allow it to start. When you turn the key on your ignition 12 volts goes to the solenoid on the starter motor. This solenoid does two things. It allows voltage to go to the starter motor itself, which causes it to spin. It also engages a gear on the shaft of the starter motor, which meshes with the flywheel on the engine. When the flywheel engages the starter motor gear, it turns with the starter motor.
Once the engine is running and you release the key, the solenoid retracts and the gear disengages from the flywheel and the engine is running some signs of a starter motor. Failing may be that the gear does not engage the flywheel, in which case you would hear a whirring sound. It could be a bad starter motor, but it could also be a dead battery or a bad cable or a bad ground connection. The best way to test a starter motor is to hook up a connection or directly to the starter motor to bypass the cable and verify that there are no issues in the wiring harness.