I have a JD 170 that developed the "clicks and won't start" problem. The following information applies if your unit has a starter with the integral solenoid, not a separate solenoid. If yours is integral, then read on!
The problem this fixes is that the starting circuit which ultimately provides power(via the purple wire) to the starter unit gets compromised and is unable to provide enough voltage and current right at the starter unit. The reason is due to voltage drop across the ignition switch, pto switch, safety switch(es), etc. that develops over time due to wear. The solenoid on the starter requires a significant amount of energy to operate and what happens is there isn't enough because of losses in the circuit.
JD created the following to address the issue. It's called a "Starting Improvement Relay Kit". It's model number AM107421. Also, if you google M77862, and look at the pdf, it explains how to install on various models and there is a simple schematic at the end. You can find a little more info by searching for "SolutionAM107421".
Here's how and why it works. The voltage and current available at the purple starter solenoid wire are not sufficient to pull it in all the way because of the aforementioned circuit losses, and hence it just clicks. However, the voltage and current ARE sufficient to operate a small relay that has heavy duty contacts. Because you have a big fat battery cable attached to the starter already, all you need to do is connect that to the place where the purple starter solenoid wire goes, via the new relay. That's what the kit does. The relay is located close to the starter and wired as described. I installed this fix and my 170 hasn't clicked in 3 seasons.
A purist might say why not fix the original problem. My hypothesis is that rather than replace every worn part of the circuit(which means Ign Switch, PTO Switch, and Safety Switch(es), this is a more practical solution. I believe there should have been more 'margin for degradation' engineered into the unit, but that just wasn't the case.
It's worth noting that a compromised ground connection to the frame can contribute as well, and that doesn't cost anything to remedy(time notwithstanding!)
A final thought is you can test if this will fix your problem, before you even buy it. All you have to do is jumper the battery terminal to the point on the starter/solenoid where the purple wire connects and if it pulls in, voila, you have a fix.