It's a very good question! The answer appears to be that there is 'mission creep', or rather that each shield wall probably edges to the right (because most men are right handed), and that inevitable means that each will outflank the other's left flank (given two equal combatants). The answer would appear to be twofold - you either protected the vulnerable flanks with terrain (stream, marsh, wall, whatever) or you put more forces there, probably cavalry, to keep the enemy honest. At Agincourt, which was basically a shield wall to shield wall battle (or at least an edged weapon to edged weapon battle) the archers on the flanks restricted the French to the centre where they got slaughtered. And yes, you kept ranks! Otherwise you're dead! Keep your shield touching your neighbour's shield, and the men behind keep shoving you forward and, when you're disembowelled, they take your place. I doubt the sides would resemble two triangles, though undoubtedly the wedge formation was used in attack in the hope of piercing the enemy's line, but once the point of the wedge was stopped then the men behind would spread into a thick line. I also doubt that such fights lasted very long. In the end the sheer number of casualties will make a barrier and allow the losing side to break contact, which would be a very vulnerable moment. The infantry clash at Agincourt was over very quickly - but only after hundreds were killed in a sudden orgy of slaughter. I'm sure these things were never neat - the shield walls would bulge, turn around each other, stumble, then one would suddenly break and all hell would be loosed.