How does natural selection result in the Viceroy butterfly bearing a close but superficial resemblance to the Monarch butterfly?
The Monarch and Viceroy butterfly bear close resemblance due to the fact they are both 'poisonous' and unpalatable, and their bright marking warn predators of this.
Natural Selection is the gradual process of whittling a species until is it absolutely perfect in its lifestyle, which is done via a certain select few organisms in a species expressing new adaptations/mutations, which if it gives it an upper hand in survival, will be passed on to its offspring, and if they survive, so on, until the old select organism in that species becomes out competed due to not having this upper hand in the 'eat, survive, breed, repeat' cycle which practically every organism is designed to do and if one can do it better, then it will survive.
These butterflies and other species which are similarly brightly patterned bodies, it is a signal to potential predators that they are poisonous/dangerous to their health, which if one these organisms are unfortunately a result of predation, could teach that predator not to hunt that said organism due to the nature of it being bad to eat.
There is also the aspect that some organisms, despite having these brightly coloured bodies and markings, is in fact an illusion, and do not carry the poisonous traits of organisms who do have the 'danger factor' and instead try to mimic them.
This has long be thought the case for these butterflies, the Viceroy and the Monarch, as the Monarch was found to be poisonous and unpalatable, which brought the idea to the table that the Viceroy was trying to mimic this and put potential predators off, this has- until recently- found not to be the case.
The Viceroy is also as unpalatable as the Monarch, if not more, so the fact they look very similar, is more coincidence than mimicry, though it could be a sort of mimicry however, being that the 2 species of organisms are both similar in colouration could have been key to keeping both species about due to a predator believing that both are the same and to keep away.
Hope this helps.