The space between the top of a single track cantilever, twin track cantilever horizontal element or portal crossbeam is for the auto transformer cable to be installed in a position of safety.
There's a potential difference (as in the electrical term) of 50kV between the ATF cable and the catenary elements, and a potential difference of 25kV between ground and both the ATF and catenary elements (the 25-0-25 figure discussed). If we assume the ATF is live at -25kV (and the catenary - contact wire etc is live at +25kV) that means ATF cables have to be a little further from anything that's live at +25kV than they do from anything that's 0V (ground), if the two come into contact, they should in theory cancel each other out to 0V, but in doing so, they're likely to damage or at least trip everything in the electrical section, as the voltage drops below the lower threshold.
The fact it's live at 25kV needs specific precautions for permanent way staff safety, because it's not tensioned and thus less likely to trip in the event of damage, it needs to be placed into a position where an insulator failure results in the ATF cable (though it's not really a cable, as it's an uninsulated wire when mounted on the OLE) earthing and tripping, rather than remaining live and dropping down to track level where anybody on track could come into contact with the cable.
It also needs to earth without coming into contact with the +25kV catenary, so as to prevent any damage potential, because you can run without ATF, not having to deal with damage to the catenary itself is a major reliability plus point. If it's not possible to put the ATF wire in a position of safety, then it'll be fitted with an earthing bar (the thing that looks like a garden rake) or ultimately, it'll be buried using insulated HV cable.
Mast height seems to be causing some confusion too, there's not a massive amount of wasted mast needing to be cut off the top, the height is deliberate give or take an inch or two.
Portal masts vary slightly depending on track alignment, the only scheme where portals have been perfectly installed was the WCML and that needed the foundations for the portals to be precisely levelled so the prefabricated portals could be installed in the correct position, there's simply too much traffic and too many H&S rules for that sort of work today.
The twin track cantilever masts have a small amount of adjustment based on the quick release mounting mechanism, everything above that is again deliberate, and single masts are as per previous electrification schemes, standard length, but each mast will be mounted at approximately the same level in relation to the running line, so height on those masts is once again deliberate.
There's only a very small difference in mast foundation height in relation to running rail, a matter of an inch or two, we're not talking about foundations being a couple of feet out and needing two or three feet cut off the top.