basically it is clicking when it doesn't get enough power, that is down to two things, a dead battery or a dodgy connection, the fact that it does something at all means that it is all connected right, but it still could not have a decent enough connection to actually function, so you need to check things like the battery terminal surfaces, the wires for any corrosion etc.
the only other thing it could be is that the starter motor has been not working for a while and carbon deposites have built up on the contacts inside the starter motor. that is easy to fix, just open it up and put it in a drill and hold the contacts with sand paper and give it a spin and it should work fine after that.