When citing an arXiv paper, what year should one write? A paper on arXiv can have multiple versions. It is rather frequent (at least in math) that the first version and the latest version are even from different years. When citing such a paper, is it better to put in the year in which the paper was first published on arXiv, or the year of the latest version (and probably explicitly saying which version is cited then)?

Assume that neither the journal nor the publisher have any written guidelines about this particular scenario; for example, when one is themselves putting a paper on the arXiv.
I would cite the exact version you are referring to in your work. Therefore the year should be the year of that version. You should also use the actual arxiv identifier in the citation. This is to minimise the effect of potential changes in the cited work on your paper. Moreover, your goal is to provide the reader with a precise pointer to the cited work so that they can easily find it.