In war in CivIV, I have found it better to play smarter, not harder, or not just building tons of units.
Make sure you're ahead in tech. Even a slight advantage like Cannon versus Knight or Musketman can mean the difference between victory and defeat. A more advanced unit can hold out better against older ones. Also remember that the 10% extra strength unit upgrades also have more punch with more advanced, stronger units.
However, a well-trained older unit can still beat a more advanced unit sometimes, so be careful! This is especially true for units that can get city defense bonuses. Longbowman with +60% defense on a city tile along with 25% fortification bonus and a large culture bonus can beat the ever-loving snot out of a Rifleman grunt.
Always be sure to bring lots of siege weapons! They can also be used as suiciders, especially true for catapults. The collateral damage component is very good for suiciding, and the taking away of culture bonuses by bombarding a city also dramatically increases your chances of capturing it.
Also keep in mind that if you can't hold on to a city you've just captured; for example, it will be taken over through influence or riot within a few turns; it is better sometimes to just raze it to the ground and burn it.
Now, sometimes the AI will be dumb and just hide in its cities with tons of units. What do you do about this? You go around pillaging all their surrounding land, especially improvements built to harvest resources like Iron. You will get extra money and you might just lure the enemy out of their stronghold. Even if they push you back, they will be much weaker than before.
Also, putting all your units into one stack isn't always a good idea. Collateral damage units can deliver a beating unto your stacked units. Because of this, it can be better to send in multiple stacks of three or four units each.
Also be sure to have a variety of units. Axemen can take out melee units; Swordsmen can take out Archers and attack cities well; Spearmen can defeat mounted units effectively. Etc.
Also take advantage of terrain bonuses. When besieging a city, it is best to hide out in forests or on hills, because they give a defensive bonus. This way it is harder for the enemy to retaliate against your invasion force. Using this strategy along with the proper unit promotions can be extremely effective against your foes.
Do an "aggressive defence" maneuver. If it seems inevitable that a particular rival civ will declare war on you, don't just sit around on your butt and let him/her start it first! I'm not saying to declare it first before they do, BUT, what you can do is move numerous stacks of powerful military units near their borders. It will sometimes discourage them from declaring war on you, because they may overestimate your strength. On the other hand, it might just piss them off.
If you want to declare war on someone, try and provoke them into doing the first move. Demand items from them time and again to provoke them, or some other method. While your doing this, make friends with their friends, and when the civ you want to attack declares war on you, their former friends may become their foes. This helps you in that they may not be as likely to attack you.
Once you get into a war, always try to be on the offensive. If you are always on the offensive, you can eventually whittle down their forces to nothing.
Don't think you can win? The enemy won't accept a peace treaty? Assuming you are only at war with one civ, there is one strategy I have noticed that seems to work, although I'm not sure if it's really effective. I try a last-ditch attempt at striking one of their most important areas, like a city with high production or pillaging all their improvements around their biggest cities. Even if I would still lose in the end, if I do enough damage, it seems, in that one attack, the enemy will allow a peace treaty, albeit for a price. However, peace treaty is better than no peace treaty. . .
These are some strategies I have noticed to have worked, although the last one is a bit sketchy.
try them out. Experiment with your own strategies, as well, and find what works best for you.
P.S. I have only been able to win as high as the Noble difficulty, so these might not be as effective at the higher ones.