I cannot help much, but here is some info:
info in english -> https://spb.hse.ru/en/io/immigration/;
registration must be performed within 7 days, with a few exceptions for citizens of some ex-USSR countries;
if you have been staying at a hotel, it must have registered you for the period of your stay, so you have some extra time;
in case of violation of the ...
Correction to the accepted answer:
"открепительное удостоверение" is not needed, it is sufficient to have your passport. See, e.g., https://newyork.mid.ru/vybory-prezidenta-rossijskoj-federacii
All events of such kind are announced on consulates' websites. I recommend to monitor the one which is closest to your resindence.
is there usually a possibility to vote in such kinds of referendums
for Russian citizens residing abroad?
There were only two referendums in post-Soviet Russian history, both in 1993, so this question would not have any precise answer.
But regarding Russia-wide elections, not referendums — yes, usually one can vote on Russian elections from abroad, but ...