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 declare war on you and you will not be able to make peace with them. This can be shockingly unpleasant if you're not ready for them.