Neutral, or in your case, park safety switch or related wiring.

Solenoid

Bad spot in armature

Worn armature bushings allowing armature to touch a field

Smacking starter with a hammer sometimes wakes up or changes things in the starter/solenoid & it starts, for a while. But it will fail again if that's it.