How often should an engine be run, to stay mechanically sound?
All your plane's systems are happier when you're flying, including the pilot.

Ideally, you'd fly often in order to keep your engine happy (distributing clean oil throughout the system to protect against corrosion and heating it enough to drive off water from the crankcase).
As a rule of thumb Blackstone Labs (the oil analysis folks) consider piston engines "inactive" if they've had less than about 5 hours of flight time per month. Their threshold used to be 10 hours, so I personally try to fly at least 10 hours a month much when practical, but 5 at a minimum.
Blackstone has a LOT of data on aircraft engine wear patterns accumulated, and I generally trust their insight in this regard (after all they're not trying to sell me an engine, just asking me to pay them to play with my used oil).

When weather or other factors mean you can't fly enough to keep your engine "active" you can preserve it in accordance with the manufacturer's instructions, but let's be honest, most of us aren't going to "pickle" our engines for the winter. It's a LOT of work, and it means you can't go fly on those nice winter days we sometimes get.  

In situations like this, it may be beneficial to ground-run your engine (say at least on a monthly basis) just to keep things lubricated and happy. Ground runs at a little below runup power or a fast idle are usually the order of the day here. Taxiing around is also probably a good idea, if practical, to keep your wheel bearings and related components moving -- maybe take your plane down to the runup pad and back.



When doing the ground run you want to observe a few guidelines to make sure what you're doing is actually beneficial to the engine:


Make sure you've got clean oil in the plane!
Any time you think the plane is going to be inactive you want to have good, clean oil in the engine (and you want to have done a thorough ground run or flight to spread that clean oil everywhere). This gives you optimal protection against corrosion.
Treat it like a flight.
Preflight the plane like you're taking it up, even if you're not.  You may not be flying much because of the weather, so there's a real chance your plane's systems will be in less-than-excellent shape. That thorough walk-around may catch a potentially expensive problem before it becomes a real issue.  
Preheat if necessary.
Hand-in-hand with treating it like a real flight, you want to make sure you're not abusing your engine in the name of protecting it.
Get the engine oil to normal operating temperature.
Part of the point of the ground run is to drive off water that has condensed in your oil -- oil is good for metal parts, and water is bad for them.
If you don't get the engine oil up to normal middle-of-the-green-arc temperatures and keep it there for a good while (20-30 minutes at least) you may not be driving out the water, which can lead to a very unhappy engine.
If you don't get the oil up to operating temperature long enough you may wind up doing more harm than good! Combustion blow-by leaking around the piston rings contains water (and a bunch of other corrosive things your engine doesn't like), and really short ground runs that don't bring the engine to temperature are mainly just causing wear from the startup and dumping these nasty things into your oil. Your engine is not going to like that.
Run long enough to recharge your battery.
Watch your ammeter/load meter after startup, and make sure that your battery has been replenished before you shut down.
This means running your engine at a high enough RPM that the charging system can charge the battery (a fast idle is usually fine), and long enough that the battery can be charged (which isn't a problem, because if you were paying attention to #4 you've noticed we'll be running the engine a good while anyway).
Monitor your cylinder head temperatures.
If equipped with CHT probes, make sure you're not exceeding the CHT limits for your engine during the ground runs.  This goes hand in hand with #7 below.
Lean your mixture to avoid fouling your plugs.
You should be using less than 65% of your engine's max rated power for these ground runs -- in fact, you should probably be somewhere around 50-60%.  Rather than running full rich, pull back on the red knob and let the engine burn cleaner (but keep an eye out for the warning signs of detonation/preignition).
You probably only want to do this if you've got Cylinder Head Temperature readouts you trust -- when in doubt you can always run full rich (for the added cylinder cooling) and just clean your plugs.


Depending on the outside air temperature your ground run may last anywhere from 30 minutes to 90 minutes (I've not personally had one last longer than that, though it's theoretically possible I suppose) -- it all depends on how long #4 and #5 above take.



A final thought: I use ASL CamGuard in my oil. It goes in with every oil change.  Mike Busch (a smarter guy than me) swears by it, and there seems to be ample real-world-anecdotal evidence as well as a good amount of actual materials testing research that indicates it's a pretty decent corrosion inhibitor.
I've not had my plane/engine long enough to know if this treatment is effective or not, but it certainly doesn't seem to be hurting anything, and while it's a little expensive it's not "liquid gold" prices, so it strikes me as cheap enough insurance that you may as well dump it in the sump. This is especially true when you weigh it against the price of a bottom-end overhaul because you got pitted cam lobes or lifters...