Pikemen are hogs for lumber. It costs a lot of this expensive resource to build them but they are most effective against Cavalry.
These troops are useful if you are attacking a city which has high number of Cavalry. Cavalry being a mount unit will attack Archers. For tactical reasons and to safeguard your Archers, a pilot wave consisting heavily of pikemen are sent to reduce this threat.
Although pikemen are expensive to build, they are not as valuable as Archers and therefore your primary intention should be to save Archers first.
However, pikemen should not be used for high level NPC attacks like NPC 10. For reasons not yet clear, pikemen seem to cause some form of troop queue issues in terms of rounds due to which the losses on Archers are higher.