There are two possibilities.
On the starter motor
there is a gear
that moves out on the shaft to engage the flywheel and turn the engine
. This can happen either with a lever attached to the solenoid, or with a centrifugal system sometimes called a "bendix drive". These systems can get sticky and work
intermittently. Pull the starter motor, clean and lubricate the shaft and gear
mechanism. If something is broken, a rebuild
of the starter will get it working smoothly again.
The other possibility (the nasty one) is that there are teeth damaged or missing on the flywheel and there is nothing for the starter to engage at some rotational positions.
I hope your problem is the first one...