Are you on a TGV? ICE? a Highspeed train in Italy? or even elsewhere?
Usually you should find a WIFI with the name of Company or the brand of your train. :)
Finally connect and you may will be redirected to a “Login” page where they ask you to reed the rules of usage and finally tick a box you red them and then start online.
It is indeed different per country-and by far NOT all trains (does not matter if its 1st or 2nd) have it-again varies an awful lot per country. Also do note that connection is pretty often very slow and may also differ along the line-many countries still have mobile lacks (areas without good connections along isolated raillines). It will do for texts, often not for those exciting youtube movies etc
In FR/TGV I noted (last autumn) it will not accept foreign nrs-but ther was a way around that (but I have forgotten how exactly).
as sebastian tells-there should-like always- appear a list of networks -and then choose. Not diferent from about anywhere else in fact