The male doesn't have to be right next to it. As long as it is close enough for the bees, the female will get pollinated. Often times there will be a male in the neighborhood that will do the job.
As for other taxon, many times male trees are planted where people don't want fruit and seeds falling - above a walkway or driveway for example.