A reply to /u/LeVentNoir
This is a rather involved question, so I'll tease out a few bits and pieces.
The late medieval saw the rise of the Swiss pikes, which used discipline and training to counter heavily armored (mounted) knights both in defense and offense.
Over time, firearms and handguns became more effective, thus there was a rather sharp transition from bows/arrows to firearms.
Pikes could stop cavalry charges, but they were vulnerable to firearms. Firearms by themselves were vulnerable to cavalry charges due to limited range, accuracy, and loading time. So they had to coordinate in close order in the pike&shot or tercio. Here's another good post.
Many aspects of this were discussed on this AMA and here and here.