I believe you're talking of the members of the families Unionidae and Margaritiferidae, which have a larval stage called glochidium. From the Wikipedia page linked here:
This larva form has hooks, which enable it to attach itself to fish (for example to the gills of a fish host species) for a period before it detaches and falls to the substrate and takes on the typical form of a juvenile mussel. Since a fish is active and free-swimming, this process helps distribute the mussel species to potential areas of habitat that it could not reach any other way.
This interesting study about phylogeny of these species shows that lures mimics mainly fish, but also different prey species such as insect larvae. Some species display an aspecific lure, while others show fine mimicking in order to attract a precise set of host fish species.
As to how luring evolved:
What drives the evolution of luring? Very little is known about what drives the evolution and diversification of luring, which has evolved independently multiple times. In Lampsilini mussels, luring appears to have arisen early, and the complexity of the lure has increased through the lineage. It is likely that diverse selection pressures govern the evolution of luring. One hypothesis is that luring increases the rate of prey encounter without incurring the metabolic costs associated with active search and pursuit. Alternatively, luring may present predators with an opportunity to exert control over a prey’s movement, reducing the risk of injury when hunting. Luring systems present a unique opportunity to understand signal design and evolution.
Do oysters need to see in order to evolve the lure?
No. Evolution of a body part does not require sight or will. From this blog post:
Note that [...] the mussel can’t see the fish it’s parasitizing. In this case natural selection is literally blind. Those mutations in the mussel that make its brood pouch look more fishlike will give it a reproductive advantage over its confrères, even if it can’t see the fish it’s deceiving. Note as well that selection has “acted” (I’m anthropomorphizing here: selection doesn’t really “act”, for it’s not an external force but a process of gene sorting) not just on the appearance of the mussel, but on its behavior. It has genes that make it wiggle its brood pouch in a fishlike manner.
The mechanism is all here:
1st step: mutations that modify the coupling of fish bites and glochidia release/mantle shape/the movement of the mantle arise.
2nd step: The bearers of favourable mutations will have more progeny and the population will have more and more bearers as generations pass.
No need of being conscious about anything. :)