When a species evolves, due to natural selection characteristics that hinder reproduction are eliminated and the characteristics that aid the process of reproduction are enhanced in future generations.
Male wasps are able to recognize female wasps by their appearance but are attracted to them primarily by chemicals called pheromones that are released by the females and to which the males are extremely sensitive to. A tiny amount of this chemical released by female wasps when they are ready to mate can attract males in the range of hundreds of kilometers.
Orchids do not have nectar to attract insects which help in the process of pollination, instead they use other means of deception. The flowers have a fair amount of similarity in shape to female wasps, but the most important tool to attract male wasps is the release of chemicals similar to pheromones that are released by the female wasps.
Orchids also have several mechanisms to alter these chemicals to attract the right kind of wasps. The sensitivity to pheromones is essential for wasps to be able to find females, if they were to lose this trait reproduction would become very difficult. This is one of the reasons why there has been no evolution to prevent the wasps from pollinating orchids.
In addition, there is no harm caused to wasps when they visit the orchid flowers and pollinate them, this removes the incentive for them to be able to differentiate orchids from females from a distance. As far as energy spent in visiting the orchids goes, it is miniscule compared to the large distances that wasps anyway have to travel in search of food and mate.