Spears were probably first used as hunting weapons, either for thrusting or for throwing; the ability to strike the prey from a relatively safe distance no doubt appealing to the hunters. It was likely recognized almost immediately that they were also most useful against predators and other humans.
Massed men carrying pole weapons with pointed tips (spears, pikes, etc.) were recognized fairly early in the history of organized warfare as effective military units. On defense the men holding the spears were hard to reach; on the attack, as in the Macedonian phalanx, they were devastating to those units which could not get out of the way.
With the advent of armored fighters, especially cavalry, pole weapons frequently combined the spearpoint (for thrusting) with an axe- or hammer-head (for a swinging strike which could pierce or break armor).
Pole weapons include the spear, the lance?, the halberd?, the pike?, the naginata?, the poleax?, the bill?, the long war hammer and many, many more.