A reputable rescue won't let you just leave with just any dog that appeals and will take quite an extensive look at what you are looking for, your lifestyle, everyone (including other pets) in the house and how a new dog would fit with them. GRWE for example, won't even let you go and meet any potential dogs unless they are convinced the dog will be a good match for you given your individual circumstances.
As Elibean said, some rescues use foster homes, so they know how the dog is in a home environment. Also, when we adopted our whippet, we spent a lot of time with him (about a month with several visits to him per week over that month) before we adopted him.
A reputable rescue will not rehome a challenging dog to a home with young children or inexperienced owners - when we were looking for our second dog, the rescue we went to would not consider us for adopting a saluki they had due to the fact that the saluki had separation anxiety and needed someone home all day (I work half-days).
On the other hand, some dogs end up in rescue in the first place because their owners wanted a puppy but didn't have the knowledge or experience to train or socialise that puppy properly and so the dog becomes unmanageable. So, in that case, a better bet would be a dog who comes into rescue due to a change in the owners circumstances, but who is already trained, used to children etc.