So that's exactly what you should do when leaving a group unexpectedly (find a replacement), but unfortunately, it's not always what everyone does. Sometimes it's a matter of availability-- just last night, our tank in Shattered Halls said he had to log out, and we just weren't able to find any warriors to replace him-- but the point is that the responsibility for filling the evacuated role should be that of the person leaving, not the group. Saying "bye" and logging is definitely one way to do it, but it's not the best way-- what you should be doing is finding a replacement.
And how's that done? First, check your guild to see if there are others of your own class around to join up. Even if not, keep in mind that you can change things around if necessary (as a Shaman, I can switch prettty easily between DPS and healing, so if our priest leaves, we're fine adding either another priest or a replacement DPS). If no one in the guild is available, then it's time to go for your own Friends list-- I've met quite a few other players in PUGs that I usually hit up for group members when necessary, and sometimes I'll even ask them to check their own guilds for replacements. And if you have to, it is possible to simply do a "/who 70 priest" query-- you run the risk of getting someone who doesn't know what they're doing, but as my grandmother always said, beggars can't be choosers.
Of course, throughout all of it, you've got to be patient-- it's fine to send someone a /tell asking if they want to join up, but if they say no or don't answer, leave them alone after that. And if a replacement can't be found, both the group and the person leaving should understand (although for Transformers, I might have delayed the movie rather than letting the 25 man raid go without). But most people play this game to actually run the instances-- with a little effort, switching out a replacement can keep an instance run rolling right along.