Since there is no skill that goes with throwing it is generally based on luck. Throwing tends to be much much more accurate the better your skill is with the throwing item in question, if no skill is applicable it's either entirely luck based or governed by strength, dexterity, and possibly unarmed. Throwing is one way to get food early in the game as a new player can pick up a rock and kill a squirrel with it. Throwing is also based on line of sight. If there is a tree in your way the item you throw will usually hit the tree and stop though sometimes it will pass the tree. Even if you almost kill a bird or squirrel when it is asleep dont give up so easily, throw a rock at it to satisfy your anger and you might even hit and kill the bird or squirrel.
Weapon skills (bow, axe, sword etc) all increase by throwing the weapon, as well as the obvious melee attacks. Bow skill is of course increased by shooting arrows. Melee type weapon skills such as axe, sword, spear etc. also increase by throwing the weapon. Club skill increases by throwing clubs or even plain rocks. So in this way the skill can be trained without actually engaging an NPC or animal. (Confirmed for 3.16)