The response of nanostructured surfaces in the near field