First, notice that there is nothing near where the train is touching the overhead wire. Distance is insulation. Then if you look closely you will probably see insulators in serveral places in the mechanical gizmo that pushes the contact against the overhead wire.
The same problem applies to high voltage transmission lines. The big ones have metal towers, which of course can't be allowed to have high voltage on them. In fact, they are deliberately grounded. The high voltage cable is usually suspended from a long ceramic insulator. This has a number of ribs or discs to increase the surface distance from one end to the other and keep water from collecting along the whole surface. Smaller but quite visible ceramic insulators will be on the power lines in your neighborhood and at the primary side connections to the transformer for your house or building. Google "high voltage ceramic insulator" and you will see many pictures and descriptions for these devices.
The insulators on the train may be of a different material, but are probably visible if you look closely.