The best way I have found to keep my units healthy is to attack with large numbers, in force. If you're taking a city, it's best to arrange your forces so you can take the city in one or two turns. More than that, and you start losing units, not only from the city's counterattack, but also from the AI bringing up reinforcements from the rear. When you hit, hit HARD, with plenty of units.
Retreat wounded units to heal them, or bring along a Medic or two.
If your ships are dying in one hit from a city, then you're probably attacking with vastly underpowered units. Most ships should at least be able to withstand one hit unless the defending city 1) is much more powerful than you, or 2) has several defensive units nearby (in coastal cities it loves to station a ranged land unit PLUS a ranged ship). Your attacking ship then takes three hits, all from the city -- city bombard, land unit bombard, ship bombard).
Train your ranged ships by bombarding land units if you can. They can't strike back and unless there are ranged units or cities nearby, you can blast them with impunity. Melee ships you can only train by taking out other ships or by making them the capturing unit on coastal cities.
The AI will concentrate on weakened units or highly promoted units. If one of those is taking heavy fire, retreat it out of range and rotate someone else in.
Also, don't underestimate the power of building units that are already promoted. Get a head start on XP (if you're going to be doing lots of warring) by building your units from cities containing XP buildings (barracks, etc.) and wonders (Alhambra, Brandenburg Gate). If you build a unit from a city with barracks, armory, military academy, and Brandenburg Gate, bombers can start with Siege I and II plus Air Repair. Add in Alhambra and your land units could start with Drill I, II and III (and possibly March as well -- can't recall, haven't done the math). If you start out with units that already have a head start like that, they're a lot more likely to stay alive longer and get even more promotions.
cheers,
Phil