A high-ranking New York Police Department official accused of posting hateful messages online has opted to retire days after the department said it was suspending him without pay.