Lots of medics with lots of ubers on high-damage-dealing classes.
Demomen, if they are any good, usually work best against a sentry farm — stickies are perfect for this job, the usual problem is living long enough to deploy and detonate enough of them.
Heavies or pyros can also be effective, if they can get close enough (short range for a heavy, point-blank for a pyro) without being overwhelmed by the knockback before they can do damage.
The medic should lead the uber combo in (particularly if the partner is a heavy) — he's faster, so he can absorb the knockback better.
If at all possible, back the uber team(s) up with as much raw firepower as you can muster — the aim is to either overwhelm the engies' ability to repair stuff, take out the engies directly, or take out dispensers.
Soldiers are good for this support role, as they can place well-aimed damage from behind the uber.
Demos can support well, too — their indirect fire can damage engies and dispensers without having to kill the sentry first.
Sending a spy in to sap just before or during the uber(s) can be a good idea, too.
gaming.stackexchange.com/users/44/Corv1nus
Unfortunately, twiddling your thumbs behind your own base isn't going to win your team the round.
If there are that many Engies, Spies will probably be ineffective.
Grab yourself some medics and frontline (or take 'em from behind) forces like Heavies, Soldiers, or Demomen, uber, and advance.
Side tip : as you advance, have your progress reinforced by your own engineers setting up on newly-won terrain behind you.
This will help your new ground to hold out longer.
Class updates will always create all-of-a-sudden influlxes of the respective classes, but just remember their strengths and weaknesses, and don't feel too overwhelmed.
gaming.stackexchange.com/users/27/rlb.usa
A lot of engineers usually involves a lot of teleports.
As a spy, alert your team about your intentions and go to sap the teleports entrances.
These will cause the engineers move the focus out of the sentries and your team should be able to put them down.
1 uber or 2 could help. ;)
gaming.stackexchange.com/users/730/Drake
As a long-time engineer player, I'd say my sentry has been killed by a soldier or demo more than anything else.
Spies are useful in hectic situations but not when there are multiple alert engineers, and ubers are useful but require careful coordination and are very limited.
I say, go with corner-edging soldiers and sneaky demos.
A big enough concentration of them can just cause so much damage the engineers can't keep up.
Also, any source of crits (buff banner, krit medic) can be a great help.
It doesn't do extra damage to the sentry but it can definitely do some serious damage to the engineer healing it.
gaming.stackexchange.com/users/122/Oak
For pre-update senties, they will always shoot at the closest enemy.
Run an uber up front to take all the sentry fire, and let the rest of your team stand behind and focus fire on the sentries without getting shot (By the sentries at least).
Soldiers work well for this, as they can straight-shoot the sentries from a distance.
Direct-hit especially so.
Just remember you need at least two soldiers per sentry or the engineer can out-repair the damage.
Watch out for pyros air-blasting you with this method.
Kill them first if you can.
Whenever ubers attack sentries, the medic should run ahead of their buddy.
This allows the medic to take the brunt of the knockback and allows both players to get closer.
This is especially important when there are multiple sentries, because the accumulated knockback can push a demo or heavy back beyond their effective range.
gaming.stackexchange.com/users/108/Whatsit
It's not just the job of spies, medics, and heavy-hitting classes, everyone can pitch in to help take down a sentry!
Scout
As a scout, you can Bonk!
in and draw the fire of the Sentry.
As long as you're the first thing it sees, un-Wrangled sentries will target you and not the rest of your team.
Even if they DO wrangle, you can still act as a distraction to the rest of the team (Spies especially love a wrangled sentry nest).
Might even get in the Engine's face and force him to accidentally shoot himself.
Sniper
Yes, you too can help take out a Sentry nest!
In fact you have the most important job of all - Taking out the Engineer!
Assuming you can get a good line of sight, one shot to his head is all it takes.
And when he's dead, there's nothing to stop you from charging a shot and picking off his unguarded sentry either.
The Machina can help damage Engies that hide behind their sentry, but for unattended sentries, the Sydney Sleeper charges up VERY fast.
For a full breakdown, go here.
If all else fails, you can always throw a Jarate grenade to soften the Engie & his pals.
Engineer
You have the pistol, which like a Scout's pistol can take down minis and level 1s at a distance.
But you've also got a Wrangler, which if you can get your sentry into position can tear through another Engie's sentry, assuming he doesn't catch on.
The best way you can help your team though is by building up a teleporter, so that they can get to and take down the other team's Sentry.
Of coures, this is only if you insist on playing these classes...otherwise switching to a higher damage-output class, a medic, or even a spy might be more useful.
gaming.stackexchange.com/users/55285/Zibbobz
As a soldier, a Direct Hit is great vs any Engineers nest, particularly in large open areas where you can outrange them.
The low splash damage of the Direct Hit is negated by the fact that sentries don't move, but most importantly firing 4 Direct Hit rockets without delay will destroy a sentry even if 1 engineer is repairing it (though 2 will likely repair through the damage).
The only trick is making sure no one kills you while you are firing.
gaming.stackexchange.com/users/86844/David says Reinstate Monica
Now that the Engineer update has come, there will be lots of Engineers building up everywhere.  How should this best be handled?
What is a good strategy to deal with lots of engineers turtling on the other team?
gaming.stackexchange.com
<team-fortress-2>
gaming.stackexchange.com/questions/1
gaming.stackexchange.com/users/11/Jeffrey
Demomen usually work best against a sentry farm. Heavies or pyros can also be effective. Medics should be in the frontline to absorb the shock. Build a teleporter to help your team through. Demomen are best against a sentry farm. Heavies or pyros can also be effective. The medic should lead the uber combo. If possible, back the uber team(s) up with as much raw firepower as you can muster. Go with corner-edging soldiers and sneaky demos.  The Machina can help damage Engies that hide behind their sentry, but for unattended sentries, the Sydney Sleeper charges up very fast.  The best way you can help your team is by building up a teleporter, so that they can get to and take down the other team's Sentry.    
Demomen are best against a sentry farm. Heavies or pyros can also be effective. The medic should lead the uber combo. If possible, back the uber team(s) up with as much raw firepower as you can muster. Go with corner-edging soldiers and sneaky demos.  The Machina can help damage Engies that hide behind their sentry, but for unattended sentries, the Sydney Sleeper charges up very fast.   The best way you can help your team is by building up a teleporter, so that they can get to and take down the other team's Sentry.    