Pikes are highly difficult to "get right", but when they are, they're not only pretty much invulnerable defensively but also very strong on the offense. Until the advent of gunpowder pike-blocks were all but invulnerable unless somehow disorganized.
The romans became very good at disorganizing the phalanx, but there aren't actually many examples of them taking it on head-on and winning. (Cynosphelae was a classic pincer manuever, at Pydna they retreated onto broken ground where the formation could no longer be held, etc.)
When confronted with a pike formation you could basically A) kill it from range or B) disorganize it until it could no longer function as a formation.
Note that keeping up a pike formation was tricky as hell, and required a lot of training.