Usually, the will specifies an executor. If not, or if there's no will, the Surrogate's Court will appoint an administrator, often the closest living relative.