This question is quite a popular one and has been discussed in the past. You may check the following responses that have been provided previously:
These responses by u/Valkine and u/Rittermeister refer to the cooperation of troops, including spearmen and missile troops.
This thread discusses the details of the potential pike and crossbow tactics of the Middle Ages.
This concise response by u/RogerWilliams1591 answers your question directly, and this answer by u/Rittermeister does it in a similar way.