Summary:

You can declare war on a city-state or another civilization through the Diplomacy Panel or by simply attacking one of their units. You can declare war on a civ by entering their territory without an Open Borders agreement, as well (except for city-states, whose borders you may enter freely). Other civilizations can declare war on you in the same fashion.