The Gemara in beitza (5a) states:
אמר רבה מתקנת רבן יוחנן בן זכאי ואילך ביצה מותרת דתנן משחרב בית המקדש התקין רבן יוחנן בן זכאי שיהו מקבלין עדות החדש כל היום אמר ליה אביי והא רב ושמואל דאמרי תרוייהו ביצה אסורה אמר ליה אמינא לך אנא רבן יוחנן בן זכאי ואת אמרת לי רב ושמואל ולרב ושמואל קשיא מתניתין לא קשיא הא לן והא להו ורב יוסף אמר אף מתקנת רבן יוחנן בן זכאי ואילך ביצה אסורה מאי טעמא הוי דבר שבמנין וכל דבר שבמנין צריך מנין אחר להתירו...
According to R' Yosef, a gzeira stands even if the reason no longer applies, unless a greater (and more numerous) beis din annuls their decree.
The Rambam rules like this (mamrim 2:2-3):
בית דין שגזרו גזירה, או התקינו תקנה, והנהיגו מנהג, ופשט כל הדבר בכל ישראל, ועמד אחריהם בית דין אחר, וביקש לבטל דברי הראשונים ולעקור אותה התקנה ואותה הגזירה ואותו המנהג--אינו יכול, עד שיהיה גדול מן הראשונים בחכמה ובמניין.
היה גדול בחכמה אבל לא במניין, במניין אבל לא בחכמה--אינו יכול לבטל את דבריו; אפילו בטל טעם שבגללו גזרו הראשונים או התקינו--אין האחרונים יכולין לבטל, עד שיהיו גדולים מהם.
He even says that gzeiros to prevent an issur can never be nullified, though I'm not sure if everyone agrees to that.
But as a general rule, a gzeira stands even if the reason no longer applies.
The Ra'avad questions the Rambam from the fact that R' Yochanon cancelled certain takanos after the churban, so you see a beis din can cancel an earlier takana even if it's not greater than previous one, if the reason no longer applies.The Kesef Mishna (I think) says that R' Yochanon's Beis Din was greater, while the Radvaz offers another answer: The Rambam was just discussing standard gzeirso that don't mention their reason. However, if the gzeira mentions the reason, it can be cancelled once the reason no longer applies (it would still require a beis din though). According to the Radvaz, you could perhaps get a beis din together to cancel certain specific takkanos that mention their reason.
Those are the basic principles, what about the practical cases?
In general, taking medicine is assur on shabbos lest you grind medicine. In recent times, people stopped grinding their own medicine, yet modern poskim still forbid taking medicine on shabbos. This fits with the general principle that gzeiros still stand even if there reason doesn't.
Sometimes common practice will seem to go against a specific gzeira. In such cases, it is common for tosafot to explain common practice, sometime with a strong justification, sometimes a bit more dochek.
I have not looked into the issue of lending with ribbis to non-Jews, but it seems many of those gzeiros in Meseches Avodah Zarah were not fully kept in Europe.
Many poskim express wonderment at the Tosafos that permits dancing and clapping on shabbos. R. M. Feinstein says that in a case where there's some [external] cheshash (such as mayim geluim from snake poison), the gzeira would no longer apply once the reason is gone. However, the gzeira against dancing is against the action itself, and it should stand no matter what. He feels the Tosafot should not be relied upon, but feels bound to provide some explanation since the Rema and common practice allow it:
ונראה לע"ד שהטעם הוא דנחשבה כלא פשטה הגזירה אף שכבר פשטה בימיהםאבל כיון שעכשיו נשתנה מכפי שהיה בימיהם שנסתלק הטעם לא נחשב מהשפשטה בעת שהיה הטעם לפשטה גם עכשיו כשליכא הטעם.
He suggests its as if the gzeira didn't spread, though its a bit unclear how that works. He then goes on to discuss how its as if a virtual gathering or rabbis annulled the decree, but says a baal nefesh should be machmir.
The Aruch haShulchan takes a different approach, and tries to justify common practice by claiming that modern clapping and dancing might not have been included in the takana, since its less in sync with the song.
Mayim Achronim is easier to explain. If it is just because of the danger of melech sdomis, then if the danger no longer exists, the issur may end. It's just an external cheshahs just like mayim geluim, etc. The question is just if there's other reasons for mayim achronim (such as having clean hands), and whether the danger is really gone.
In conclusion, the rule is that gzeiros apply even if the reason no longer applies, but poskim may try to find kulos to justify common practice. So if modern circumstances are different they may not have been included in the takana. If a gzeria is just because of an external chesahsh, it's easy to say it ends once the reason ends.
Links: