Mr. Mamdani reaffirmed that he would govern New York City as a democratic socialist and assured even those who had not voted for him: “I am your mayor.”