Several years ago Dragon magazine published a series about how to run a Gith invasion of the Prime Material Plane and some of the best games I've ever run or played in had some sort of invasion meta-plot. But how does one go about effectively running this type of campaign. The investment is considerable, the risk is great but the reward can be immeasurable.
First, decide what kind of invasion you want to deal with: land, water, dimensional, time, etc. Next, you need your invading race, why they are invading and who/where specifically they are invading. Then think about the duration of the invasion and what it's ultimate goal must be. An invasion for no good reason just doesn't make sense and eventually, your players will catch on that there isn't a real "end-game". Also consider what factors might change the success or failure - obviously if your players are the heroes, then stopping the invasion is the end, but what else might affect it? Then consider the level ranges your players will be and what, if any, special gear/items/magic/abilities will be needed, wanted or overpowering. By that I mean don't have a fire elemental invasion if your players are immune to fire.
So obviously you don't want to have your players completely dominated by the invasion, but you don't want them to easily stop it either. You have two easy options. The first is scaled encounters with mixed monsters and monsters with character levels. Most everybody is doing this now, so it shouldn't be anything new, especially if you are running a 3.X, Pathfinder or 4.X edition game. The second option is totally on the players to achieve - the ability and willingness to retreat. Yes, your players need to be able to recognize when to run away so that they live to fight another day. I have personally had very mixed results with this option, both as a player and as a DM. The last party I DM'd for was split on retreating with a couple of party members running away and the rest staying and dying, it created some hard feelings and helped lead to a split in the group. As a player, I never ran from a fight until I played Hackmaster, then we ran on a regular basis, yes, we lost honor and a little loyalty from our henchmen, but we lived and eventually succeeded.
Now you have your invasion type, your invading race, your target area and residents, the speed of the invasion, the goals of the invasion, the incidentals and hopefully a party willing to take on the risk of stopping an invasion, what's left? Well executing it, adjusting it, changing it, reacting to it and enjoying it. Just like any campaign, things will have to be modified, tossed out or added, but give it some time and attention and you will really enjoy it.