There's no definite answer to any of your questions. All of these details depend a lot on the professor, the circumstances (e.g., funding), and you:
How to approach professor X to ask if I can visit him and what sort of information should I provide?
I would assume a mail is sufficient. However, if you don't know the prof personally, and you are not overly well-known in your community yet, it may be better to ask your advisor to establish contact. Professors get many mails from prospective students on various levels, with various intends. Those mails tend to get discarded quickly and unceremoniously.
I don't know what information would be required, initially probably almost none, except who you are and what you would like to work on with the professor. At a later point, details of how this visit would be funded may become an important discussion item (e.g., who pays your travel? who pays your hotel / apartment? if you are an university employee, who pays YOU during your visit?). Don't expect your host to arrange funding - this is something that you / your advisor will need to arrange, and just agree with the host.
When PhD students visit academics, what happens usually? I mean, would professor X become a sort of supervisor for the time of the visit, or would it just be that me and professor X would mostly be in the same place at the same time and able to chat a bit if the opportunity arises?
I have seen both happen. Clearly, in the second case, the visit is often close to worthless. However, in most cases, the truth is somewhere in the middle. The prof meets a few times with the visitor, and "appoints" one or more of his own students with a matching profile /research interests as a contact point and collaborator for the visit. You should not have too high expectations of how much time your host can really invest into you (and not into, say, his own students or his own research).
How long do visits last, usually? Would I be a student at professor X’s university during the time of my visit? Would I have any academic requirements (e.g. to give talks at seminars, etc.)?
Depends. I have so far done two research visits, one as a short as 2 weeks, one for 6 weeks. I know of others who have done visits for up to 6 months. You usually have little academic requirements, and you are not usually considered a student of the host institution (at least for visits that are shorter than one term). Giving a talk is sometimes necessary as part of your funding arrangements. For instance, in my second stay, my travel was funded by the host institution over the vehicle that they officially invited me as an expert speaker for their seminar series (so that they could formally pay for my travel, which they could not do for a visit). In my first visit, the expectation of the funding source was that at some point a paper would be published related to the visit (clearly not within those two weeks, but at some point). Further, I had to write a brief report.
Professor X is in a different country than I am. Are professors based in a different country than a potential visiting student more reluctant to let students visit them? If so, why?
Not typically, however, finding funding may be even more difficult. However, both of my visits have been cross-country, in one case cross-continents, so it definitely can be done.