|Controlling the relative phases between |
antennas in an array lets you steer radiation.
By Davidjessop - Own work, CC BY-SA 4.0,
This is precisely the same math that gives you diffraction patterns. You can also do this actively with radio transmitter antennas. If you set up an antenna array and drive each antenna at the same frequency but with a controlled phase relative to its neighbors, you can tune where the waves constructively or destructively interfere. This is the principle behind phased arrays.
An optical metasurface is an interface that has structures on it that impose particular phase shifts on light that either is transmitted through or reflected off the interface. Like a metamaterial and for the same wave interference reasons, the optical properties of the interface on distance scales larger than those structures can be very different than those of the materials that constitute the structures. Bear in mind, the individual structures don't have to be boring - each by itself could have complicated frequency response, like acting as a dielectric or plasmonic resonator. We now have techniques that allow rich fabrication on surfaces with a variety of materials down to scales much smaller than the wavelength of visible light, and we have tremendous computational techniques that allow us to calculate the expected optical response from such structures. Put these together, and those capabilities enable some pretty amazing optical tricks. See here (pdf!) for a good slideshow covering this topic.