I've run numerous war-themed adventures that included mass combat - to varying degrees of success. Nothing I'm about to write is new info or particularly ground-breaking - most sourcebooks that address the topic offer some of all of the following suggestions. However, if there were one flaw that the authors of these books and RPG-forum-posters fall victim to is the one-answer solution. I used to fall into the same trap, but if there's one piece of advice I can share, it's that you should determine the reason for including the event in the adventure/campaign/story -- answering that question will help you select which option, or combination of options, may work best.
1) War/battle as backdrop.
How to run it: Mass combat is off-screen. PCs focus on special forces style missions - rescuing prisoners, assassinating enemy commanders, inflitrating behind enemy lines, etc. They may see the build-up or aftermath of a major battle but won't participate it.
Pros: Supports standard play. No special mass combat rules required.
Cons: Outcome of battle is strictly determined by GM-fiat.
2) Set-pieces / Flowchart. (Non-HoB approach)
How to run it: The "camera" stays with the PCs. They are in the thick of battle but the focus is on the individual battles the PCs are engaged in. You create a series of encounters/opponents, i.e. "set-pieces" that the PCs will enconter over the course of the battle. Since the larger battle rages around the PCs, you still need to decide the likely victor. Also, if you want to depict the fog-of-war, chaos-of-battle - don't let the PCs fight every opponent to the bitter end. For example: They may start the battle engaged against 3 orcs and 2 goblins, but on round 3 - a hobgoblin attacks a PC while the PC's orc opponent is carried off by the press of battle.
Pros: Again, standard rules apply as the focus is at the character level.
Cons: Outcome of battle is largely (but perhaps not solely) determined by GM-fiat.
3) Set-pieces/Flowchart (Heroes of Battle approach)
How to run it: Create a series of encounter and flow to the battle. Most encounters should include two outcomes - one if the attackers are successful, one if they are not. Ideally, more than one path, or frontline of battle, is available. Each encounter/objective is worth a # of Victory Points. The PCs select (or are assigned) a path that places them on the flowchart. If they successfully defeat their foes or obtain their objectives, they earn Victory Points for their side. Define victory/defeat conditions based upon Victory Points gained. This way, the PCs actions directly influence the outcome. If they don't earn enough points, their side may be defeated, but they may not be slaughtered or routed, for example.
Pros: Standard rules for resolving the set-pieces. Includes strategic component (one path may accumulate Victory Points faster/easier than another; or be high-risk, high-reward).
Cons: Pre-defined encounters. Multiple paths recommended but results in more GM prep. Need to define "baseline outcome" that the PCs can then influence.
4) On the front lines/commanding the troops.
How to run it: If the PCs are commanders of the troops or just enjoy the tactical/strategic element of running the mass combat, you're going to need some mass combat rules. As others have noted, there are several options out there. Most are bundled in sourcebooks that also deal with rulership/realm management. I've purchased AEG's empire, Mongoose's Strongholds & Dynasties, and Eden's Fields of Blood and have Cry Havoc or a subset from Green Ronin supplement somewhere. My system of choice is Fields of Blood as I felt it kept the basic D&D combat mechanics in place while providing meaningful tactical choices but they all have their good and bad points. You need to develop the forces for both sides and design the battlefield.
Pros: Strategic-level combat. Outcome of battle is not pre-determined.
Cons: Need to learn mass combat rules. Need to prep both sides. Doesn't normally focus on PC-scale actions unless combined with one of the other options listed above.
Personally, I've had best results in combining 3&4. Some players love the min-game of moving troops and planning strategy. Others just want to flex their D&D muscles in a non-dungeon environment with larger stakes on the line. By merging 3&4, I've been able to satisfy all players.
Also, each battle/scenario is different. My current campaign is a war-themed one. I've had battles that focus on the macro troop level (combining #3 & #4), PC-focused (#3), and war-as window dressing (#1). Figure out what works best for your adventure/story and have at it!!