I've heard that once you enter Ravenloft, you cannot leave. This is a bother for the planar adventurer who accidentally stumbles into that realm.
Are there any ways to leave Ravenloft, in any edition of D&D?
Yes, that's right. The point of Ravenloft is to be an inescapable prison for the Dark Lords, their eternal torment, their eternal suffering. And everybody else that gets sucked into Ravenloft is there to extend their pain.
That said, nearly half the published modules under 2nd edition had one way or another to escape the realm. But that was because most of those modules started with characters getting into Ravenloft through the mists, getting dropped into the domain of a dark lord, solving issues related to his/her backstory, then getting spat out of the realm by the end of the adventure.
So, there are no specific ways to escape. You escape when the Dark Powers are done with you, once you have served your purpose of extending the suffering of the dark lord imprisoned there. The 2nd edition Domains of Dread mention two (rather vague) ways to escape:
Portals: While there are no permanent portals out of Ravenloft, temporary gates to the Prime Material Plane do exist. As a rule, however, these gates must be triggered by some natural or supernatural act. Examples of such triggers include astronimical phenomena (like eclipses and conjunctions), the completion of certain arcane rituals, and the fulfillment of macabre prophecies. When and if a portal to the Prime Material Plane can be found, it can seldom be directed or controlled. Indeed, these fleeting gateways are often as hazardous to use as they are to ignore. When stepping into such a portal, the user usually has no idea where he will emerge. Of course, more than one adventurer has noted that almost any place is better than the Demiplane of Dread.
The Mists: Just as they draw people into Ravenloft, so can the Mists transport them out. While this is not a common occurence, it has been known to happen from time to time. This is by far the least common and least reliable means of escaping from the Demiplane of Dread. A hero who decides to simply sit back and wait for the Mists to return for him is likely to grow old and gray before he actually gets home, if he ever does.
While the 3rd edition Ravenloft Campaign Setting straightforward on the subject:
nothing short of a major artifact or the intervention of a deity can provide passage to other planes.
Keep in mind that divine intervention is pretty much a joke here, since there are hints that deities have no power inside Ravenloft, instead, the divine powers of religious characters are granted by the dark powers themselves.
Curse of Strahd in 5th edition provided a fairly straightforward method of escape from Ravenloft- kill its master. Of course, that comes with the caveat that
Strahd doesn't stay dead, and once he returns to unlife the path is closed again.
It is also implied that the dark powers that created the demiplane can control the comings and goings of its denizens. Further, at least one NPC archwizard has the ability to leave of their own accord.
All this is just for 5th edition, you'll want to check other editions for more.