Many endoparasites acquire hosts by passive mechanisms, such as the nematode Ascaris lumbricoides, an endoparasite of the human intestine. Ascaris lumbricoides produces large numbers of eggs which are passed from the host's digestive tract into the external environment, relying on other humans to inadvertantly ingest them in places without good sanitation. Ectoparasites, on the other hand, often have elabourate mechanisms and strategies for finding hosts. Some aquatic leeches, for example, locate hosts by sensing movement and then confirm their identity through skin temperature and chemical cues before attaching.
The hosts of parasites often evolve elaborate defensive mechanisms as well. Plants often produce toxins, for example, which deter both parasitic fungi and bacteria as well as herbivores. Vertebrate immune systems can target most parasites through contact with bodily fluids. Many parasites, particularly microorganisms, evolve adaptations to a particular host species; in such specific interactions the two species generally coevolve into a relatively stable relationship that does not kill the host quickly (since this would be detrimental for the parasite as well).
Sometimes, taxonomy of parasites can elucidate how their hosts are similar or related. For instance, there has been a dispute about whether Phoenicopteriformes are closer to Ciconiiformes or to Anseriformes. They share parasites with ducks and geese, but not storks. One of these parasites is a louse named Anaticola phoenicopteri, which means "They live on ducks, but this one belongs to the flamingo". So they are closer to Anseriformes.
See also: mutualism