Summary:

You can declare war on a City-State at any time. You can do so through the Diplomatic Panel or by ordering one of your units to attack a City-State's unit or city. You can offer peace to a City-State through the Diplomatic Panel or by clicking on the city.

It's important to remember that if you attack too many City-States, many will grow wary of you, causing your minimum influence level to permanently drop from 0 to -20.