There are really two reasons.
First, fighter tactics have evolved over time, and second, the role of the B-52 has evolved over time.
Fighter tactics Fighters used to depend (heavily) upon getting fairly close to an enemy, and shooting it down with a machine gun.
Over the years, guns have become less and less dominant, and instead fighters tend to use missiles from outside a machine gun's effective range.
Role Change
The B-52 was designed from the beginning to carry nuclear weapons.
Nonetheless, it's never been used to actually bomb an enemy with a nuclear weapon.
Early in its life, the B-52 was used to drop conventional bombs on enemies though.
During the Vietnam conflict (in particular)
B-52s were used to drop thousands of conventional 500 pound bombs on various targets.
The Linebacker II campaign was, perhaps, especially notable.
During Linebacker II, 15 B-52s were lost--all of them to surface to air missiles (SAMs) not enemy fighters.
Linebacker II did see some limited success from tail guns as well: two B-52s shot down two MiGs.
No B-52 (nor any other aircraft of similar size) has shot down an enemy fighter since.
Now, B-52s act as an aerial platform for launching stand-off weapons.
Its normal operation is to fly in low (where it's difficult to detect on radar), and launch from a substantial distance from the target.
Since it can be a substantial distance from the target, an enemy would need to defend a much larger perimeter (e.g., a large number of fighters basically blanketing a large area) to stand a decent chance of intercepting it.
Even if we assume an enemy fighter were to intercept the B-52, we get back to the situation with fighter tactics outlined above--
they'd be unlikely to get within range of its tail gun anyway.
aviation.stackexchange.com/users/4021/Jerry Coffin
I was in the United States Air Force (USAF) working B-52's when the tail gunner position was retired.
The reason was that it was deemed ineffective.
As the answers here point out, fighter aircraft evolved such that medium and long range air-to-air missiles were the primary weapons.
This kept fighters out far enough that the tail gun cannot hit.
But another very important reason was that the electronic countermeasures on the B-52s evolved such that it became the primary defense and was very effective.
Another major factor was that the fire control system was dependent on a radar transmitter/receiver.
That in itself is a problem, because the radar signal could be detected and identified.
When you are flying into enemy territory, you really don't want to do it with a radar transmission signal that says "BUFF OVER HERE WITH
LARGE PAYLOAD THAT WILL DO MASSIVE STRATEGIC DAMAGE IF WE GET THROUGH".
It needed to be re-engineered to be more stealth, and the USAF didn't assess the time and cost to do that would pay off.
aviation.stackexchange.com/users/28313/Thomas Carlisle
Flexible gunnery is useless against surface-to-air and air-to-air missiles.
Which is the backbone of today's air defense systems.
Instead bombers have other means to distract said missiles.
( Source )
Flares and such.
aviation.stackexchange.com/users/14897/ymb1
Because the defending nations stopped sending fighter planes at them to shoot them down at close range (where those guns were effective) and instead launched Ground to Air or Air to Air missiles at them from a larger distance.
This meant that it's more important to defend against missiles than against fighters.
aviation.stackexchange.com/users/609/ratchet freak
Gun turrets are for defending against aircraft that are within gun range.
However, modern fighters will usually lock on and fire missiles long before the fighter is within the range of a gun turret.
aviation.stackexchange.com/users/22661/Devil07
Nowadays, you can lock onto planes that you can barely see or even not see at all.
On the other hand, you have a very limited effective range with machineguns.
Also, keep in mind that shooting down a plane from another plane is very hard (check videos on gunner training in WWII).
Now imagine trying to do so on very fast planes like nowadays fighter jets.
To sum things up, most of the time, you won't even be in range to be able to use your machine guns and, even if you were, it would probably be really hard to defend yourself effectively.
Keep in mind that adding these machineguns weights down the aircraft and might even hinder the installation of more important equipment like flares or jammers.
There was a tailgunner on the B-52 because the use of canons by jet fighters back in the Vietnam war was more common than nowadays.
aviation.stackexchange.com/users/24929/Hawker65
Modern fighters are usually armed with missiles, with which they can engage from far beyond the range of guns.
At least one North Vietnamese fighter was shot down by a B52D's rear gun armament during the Vietnam War, however.
aviation.stackexchange.com/users/26711/J. Southworth
I know that for a period of time the B-52 had a tailgunner, but nowadays many heavy bombers lack any turret defense.Why?
Why don't modern heavy bombers have gun turrets?
aviation.stackexchange.com
<military><bomber>
aviation.stackexchange.com/questions/47607
aviation.stackexchange.com/users/27442/TheSleepingInsomniac
Nowadays, the main weapons against bombers are ground-to-air missiles, machine guns would be useless against these, hence no need for a gun turret. The main reason is that fighter tactics have changed; guns are much less used and instead fighters use long range air-to-air missiles. Guns are useless against either those, or surface-to-air missiles. The guns do not have the necessary range to be effective. The role of the B-52 changed together with its electronic countermeasures and it became the primary defence, losing the gun turrets in the process. Another reason is that the fire control system operated using a radar. These machineguns weighted a lot and left no room for more important equipment, i.e. flares, jammers, etc.
Fighter tactics have changed; guns are much less used and instead fighters use long range air-to-air missiles. Guns are useless against either those, or surface-to-air missiles. The guns do not have the necessary range to be effective. The role of the B-52 changed together with its electronic countermeasures and it became the primary defence, losing the gun turrets in the process. Another reason is that the fire control system operated using a radar. These machineguns weighted a lot and left no room for more important equipment, i.e. flares, jammers, etc.