In the three years since Michael R. Bloomberg succeeded Mr. Giuliani, the city has spent close to $2 million to settle lawsuits brought by residents and city workers who accused the Giuliani administration of retaliating against them for exercising free speech or other constitutional rights.