[This post is part of a larger strategy guide for Civilization 6]
Offensive wars: do your research
Before starting to prepare for war, it's worth doing a bit of research to make sure the timing makes sense. You don't want to walk into a well defended enemy.
Check when your opponent gets their unique unit, and what the unit is. Make sure to check how cheap the unit is compared to it's replacement so you can get a sense of how many units your enemy can pump out. If it's a strong unit that's coming up soon, delay your war until after it's viable.
Check the military score in the ribbon. This can be a rough heuristic for army strength.
Check the tech tree to see what unit they've likely researched most recently. Ideally you can catch them when they are farthest away from getting a new era's unit upgrades.
Check the civics tree to see if they have Nationalism or Mobilization. Check governments to see if they are using Oligarchy.
Check the great people recruitment page to see if they've gotten a great general recently, and if so, what era's units it improves.
Check the closest cities to see if they have or are building walls. That will impact which units you build and whether you need to build siege (see below).
Before starting a war, you need to make sure you have an edge. Doing a bit of research before you start building units can help ensure you have as sharp an edge as possible before the war begins.
Capturing Cities: Blitz Offense
A blitz offense is entirely about surprise and speed. Your goal is to capture a city before an opponent really has a chance to respond — that is, within 5 turns max, ideally under 3.
For this to work, you need to essentially declare war and move to position within your first turn. To be more specific: if you're trying to take a city, you need to have that city mostly or fully surrounded so you can put it under siege/stop it from regaining health after an attack. Unless you're very close to your neighbors, the only way you can do this is with fast moving, heavy hitting units like cavalry.
It's near impossible to take a city that has walls without siege units. Siege units are some of the slowest units in the game. Most ranged siege (catapults, trebuchets, etc) cannot move and attack on the same turn1, requiring at least one turn of just positioning. So if you're going for a blitz offense, it more or less has to be against a city that does not have walls at the start of the attack — your goal is to take the city before walls can come up2.
If you are close enough to an opponent, or you are in the ancient/classical era, you can pull off a pretty successful blitz offense with a swordsmen timing push and a few of these guys:
When used correctly, siege towers and a few melee units can almost fully neutralize any benefit of walls.
When successful, a blitz is great because you spend minimal time actually at war. But any blitz attack plan requires observation, timing, and a lot of luck — if your opponent is paying attention at all, you won't really be able to make this happen. And a blitz often doesn't have a ton of follow up — eventually, your opponents still grind you to a halt through walls or units.
Capturing Cities: Siege Offense
A siege offense is about wearing down an opponent over many turns of warfare. Your goal is to capture an entrenched position — a highly populated city with walls, encampments, and units as well as other nearby cities that can pump out reinforcements.
Like the name suggests, a siege offense is about siege — both the process of laying siege to a city, such that it can no longer heal over multiple turns; and your siege engines, that allow you to get close enough to actually capture the city.
Quick note: when I'm talking about siege units, I'm generally referring to ranged siege units — that is, catapults, trebuchets, bombards. Support units like battering rams and siege towers are important, and you should try and sneak them to the front lines to draw your opponent’s attention, but they tend to just sit with your melee units and you don’t have to do much else strategy wise.
Because you need a lot of siege engines, and because they are slow, you need to think deeply about how to make sure they are protected for long enough to be useful. Generally, this means thinking about the shape of your offense, and that in turn depends on the positioning of the field.
First, you should always look to put down an offensive encampment — that is, an encampment that is within two tiles of an enemy city or encampment. An offensive encampment is really strong because it gives your siege more turns of protection. It's often worth buying tiles for an offensive encampment well in advance of an attack.

Second, make sure you have a healthy mix of melee, ranged, and ranged siege units. You probably need more than one siege unit, because it is difficult to use them before they are killed by attacks from city walls or ranged units3.
Like many other strategy games, civ has rough rock-paper-scissors way of thinking about units. In short: ranged beats melee beats anti cav beats cavalry beats ranged. Also, separately, everything is pretty strong against siege. As a result, your army composition will ideally have a mix of unit types.
Often, I will skip over anti cavalry entirely, only building them if a city state quest requires one. Though anti cav are slightly stronger than melee units and don't have a strategic resource requirement, they are slightly more expensive and still get hammered pretty hard by ranged units4. And besides, most battles turns on the interaction between ranged units, and how quickly they can tear through everything else.
Your enemy will be focusing heavily on your siege units, and your primary aim is to protect them. If your opponent has a walled encampment, do the following:
Keep your units two tiles away. They should never be under attack from the city walls and the encampment at the same time.
Put your siege engines and ranged units in the front, so you can rain down on the encampment walls.
Have enough ranged for a secondary backline; if enemy units approach the middle between the encampment and the siege, use your combined ranged units to take them out before they can damage your siege.
Keep your melee units in the flanks to protect against cavalry, and to swoop in once the encampment is down.
Once the walls are down and the health is low, move your melee units in to finish the encampment5.
Taking down a walled city has a slightly different playbook, because you're less likely to have distance between your siege and the enemy's units.
It's much more important to move forward in formation — melee first, siege after, ranged on the sides — so you can keep your siege somewhat protected.
If you have cavalry, they should either be pillaging or taking out enemy ranged units.
Move forward until your siege units are in firing range. Don't attack with the melee units in front unless you're preventing enemy ranged units from attacking your siege. Your goal is to hold the line for your siege units until the enemy walls are down.
Try your damned best to get a Great General. Siege units generally cannot move and attack on the same turn, but great generals increase the movement speed of everyone in their area of effect. With a Great General, you can move your siege into position and attack on the same turn.
Once the walls are down, you can move in in earnest. Try and position your melee units to put the city under siege and prevent it from healing. If everything goes well, you should be able to finally take the city pretty soon after.
While a siege offense is consistent and near unstoppable if done correctly, it also takes a lot more time than blitz. Most civilizations cannot sustain a long term war, especially if other human players have time to react to aggression. You should aim to end a siege offense within 10-20 turns.
Forever war
Most civilizations can't sustain a long term war, but some can.
The primary reason that sustaining war is difficult is because the resource consumption that goes into war does not go into improving your infrastructure (see: ramping and war in the strategy section). As a war goes on, your opponents have opportunities to get stronger, more defensive troops, and have the ability to update cards, governors, and production to offset the attack.
So, if you have the ability to offset your war costs, you can sustain a longer war.
Broadly, there are two kinds of civ abilities that make long term war easier.
Those that get free units from other infrastructure (e.g. Lincoln, Elizabeth)
Those that get combat or infrastructure bonuses from capturing cities (e.g. Shaka, Alexander)

Civilizations with these abilities can wage war more cost effectively than their opponents, which in turn allows for longer wars and more opportunities to accomplish strategic objectives.
Though Great Generals change this — see the section on Siege Offense for more.
Sometimes you can get your siege in place with some really good/lucky road placement. But you should still be planning to knock down any walls within essentially one or two turns.
A city and encampment with Victor can fire off 6 "protected" ranged attacks (2 from the encampment, 2 from the city, and 2 from ranged units in each). That will kill most siege pretty quick.
If I don't have the right strategic resources, or if I'm going up against a civ with a unique cavalry unit, I might build anti cav for defense. And of course I'll build anti cav unique units, like Greek hoplites or Zulu impi. But I almost never need anti cav for offense — after all, if I don't have strategic resources, I probably shouldn't be going on an offensive war.
If you move fast enough, you might be able to kill any unit your opponent still has inside.