Close enough for shade, but far enough for free air movement and easy access is the common recommendation. It may be easier to get shade on the AC unit with a tree but if a shrub is choosen, the bigger it will get the better the shade benefit will be. Stay far enough away, though (at least 3 feet from the edge of the shrub canopy to the AC unit), so that there will be free air movement around the AC unit. Don’t forget the tree or shrub will grow. Consult the literature or a knowledgeable plant person to find out how wide and tall the shade tree will get.