Recoil is a subject which has been studied by shooters ever since the first musket. There are a lot of things which affect recoil, or don't, and some of them seem counter-intuitive. It's most useful to separate recoil into two categories: base recoil (which doesn't take into account modifiers such as stock design, muzzle brakes, etc) and recoil modifiers (the aforementioned widgets). This can be modified with recoil pads, complicated spring systems, etc.
At its core, recoil is simply the counter-force created by the expanding gasses behind a bullet, pushing it down the barrel and down range. There are two factors behind felt recoil: the magnitude of the energy being exerted, and the duration of the energy. X joules of energy being exerted on your shoulder within Y seconds, will absolutely result in more "felt" recoil than the same X joules of energy being spread out over 2Y seconds.
That having been said, every recoil reduction device out there does one of two things: it reduces the magnitude of the impulse by counteracting it (as in the case of a muzzle brake), or it increases the duration of the impulse by spreading it out over time. It's also possible for a device to reduce recoil by permanently compressing, but this is not a reusable device and I'm not familiar with any in current use.
Shooting stance, grip, and stock position, although they affect felt recoil greatly, are not covered here. This article is solely on how a firearm can intrinsically have more or less recoil (or perceived recoil, dependent on the change).
Basic (Gun-side) Recoil Variables
Barrel length: All other things being equal (particularly the weight distribution of the weapon, which typically changes if you shorten the barrel!), a longer barrel will always result in more recoil. The longer the bullet is in the barrel, the longer it's being pushed by the gasses and the more kinetic energy is being provided. It's worth noting that very short barrels typically exhibit far less recoil than longer ones, at the expense of muzzle velocity.
Weapon Weight: A heavier weapon requires more kinetic energy to move backwards during recoil, than a lighter one. This results in a longer duration of recoil, which reduces the felt recoil considerably.
Weapon Balance: "Flip" - a significant factor of perceived recoil - is a function of the relative location of the chamber, the length of the barrel, and the weapon's center of gravity. A revolver with a barrel 1.5" above the web of your palm will exhibit much more flip than one with a barrel 1" above the web of your palm. When people complain about a revolver "beating up their wrist", it's typically a complaint about flip. The most common way to counteract muzzle flip is a muzzle brake or a ported barrel.
Basic Ammunition Recoil Variables
Bullet weight: All things being equal, a 185 grain 45ACP bullet exiting a barrel at 1000 feet per second, will exhibit significantly less recoil than a 230 grain 45ACP bullet travelling at the same speed. This is a simple matter of physics. Because more force is required to accelerate the bullet, more force acts upon the shooter.
Powder quantity and type: More powder generally translates to higher velocity and more recoil. But, as noted earlier, if the powder is burning outside of the barrel (i.e. as muzzle flash), the powder which burns outside of the barrel does not actually generate significant recoil. The recoil is strictly generated by the powder which burns before the bullet has exited the barrel. Another significant variable is the burn rate of the powder, i.e. how quickly it burns. A slow-burning powder which is still burning after the bullet has left the barrel will generate a spectacular fireball, but not considerably add to recoil or performance. A fast-burning powder which has stopped burning long before the bullet exits the barrel, will probably have subjected your weapon to much higher pressure than necessary.
Recoil Modifiers
Compensators: These are a type of muzzle brake which vent gas vertically to counteract "muzzle flip" when rapid-firing. A compensated (or "ported") barrel, is a barrel into which cuts have been made to vent the gasses (generally upwards, for muzzle flip). Compensated barrels do sacrifice muzzle velocity, but they do not add additional length/weight to the end of the barrel like a muzzle brake. Ported barrels are almost exclusively encountered with handguns.
Forward pistol grip: This allows the shooter's off hand to absorb some of the recoil which would otherwise be transmitted to the shoulder. It also adds front weight, which can be useful in controlling muzzle flip.
Grips (handguns): In handguns, rubber grips generally reduce felt recoil versus plastic grips. This is partially due to the springiness of the rubber, but also has to do with the fact that the rubber increases the friction between the shooter's palm, thus reducing the amount of recoil which is imparted to the web of the hand. Texturization of grips (competitive shooters frequently add skateboard tape to their grips) also serves the same function.
Muzzle brakes: Muzzle brakes are devices which are placed on the end of the barrel and vent the gas in some given direction to reduce recoil. Because they are more or less being used a a "retro thruster", they are indeed acting to reduce the magnitude of the overall recoil. It's worth stating that the single most effective muzzle brake I've ever felt, is the one built onto the end of the Egyptian Hakim 8mm rifle. The Hakim's brake's holes are actually drilled at an angle facing rearward, instead of the more conventional straight-in holes drilled in most brakes. The AK-47's "Slant Brake" is typically angled to vent gas at a 1:30 o'clock position to counter the AK-47's tendency to drift up and to the right.
Pistol grips (rifles): Installing a pistol grip on a rifle simply serves to provide another point for the recoil impulse to act against. The shooter's hand thus absorbs more of the recoil than it would've been absorbed with a conventional rifle stock.
Recoil pads: Recoil pads are another tier which spreads out the recoil impulse. The pad is built out of some kind of material (honeycombed synthetics, rubber, and rubber-covered foam are common), and either affixed to the buttstock of the rifle or worn on the shooter's clothing.
Spring / Weight Systems: The Blackhawk recoil reduction systems (formerly by Knoxx) utilize a weight and a spring to spread out the recoil duration. There are probably other designs which do this as well.
Stock design: The material which a stock is made from, may "absorb" recoil as well. In this case, "absorbing" is simply a matter of spreading out the recoil impulse over time. In addition to weighing more than a bare action, a stock may be made out of a "springier" material which compresses slightly when firing (thus spreading the duration of the impulse).
Some Pistol Considerations
Frame composition: Light weight alloy or polymer frames tend to exhibit "trigger slap" far more than their counterparts, even if recoil itself is mild. I'm still doing some research on trigger slap as pertains to recoil, as there can be a correlation.