They have been the weapon of choice for trained soldiers for maybe 5,500 years, spears have been around for 300,000 years. Spears require less training to stand on even ground vs a better swordsman, have a length advantage, better maneuverability, cheaper, can be thrown (atlatl, javelin, pilum).