The big change started in the late 1990s with the launch of href="http://bepposax.gsfc.nasa.gov/bepposax">BeppoSAX, an Italian X-ray satellite. This satellite could detect gamma ray bursts and then turn and point X-ray imagers at the burst. This allowed the position of the burst to be determined to within a few arcminutes (about 10% of a degree in size), whereas before we only knew the positions of gamma ray bursts to within a few degrees, or an area of sky 30 times the size of the full moon!
Coordinates accurate to a few arcminutes are good enough to try looking for the source of the gamma ray bursts in visible light using giant telescopes (which typically can only see an area of a few arcminutes in size). And, when astronomers started to do this, they detected optical light from the gamma ray bursts, but only the long gamma ray bursts.
Further study found that these gamma ray bursts were happening in distant galaxies most of the way across the Universe, and that these galaxies were almost always making new stars at tremendous rates. This was a crucial find, as it tells us that the sources of gamma ray bursts come from young stars but not from old stars. And there is one other astronomical explosion with the same characteristic: supernova explosions. One clinching piece of evidence came in 1998, when a nearby gamma ray burst was discovered, and after the optical light from the burst faded, a supernova appeared in the same spot.
So, it seems that gamma ray bursts are linked to supernovae. The best current idea is that the entire system starts out as a star tens of times more massive than the sun. These giant stars burn up all their fuel in just a few million years, and end up with a core of iron more massive than our own sun. The special thing about iron is that there is no way to get more energy out of iron by nuclear fusion -- it is the ultimate ash. But it is the energy from nuclear fusion that keeps gravity from collapsing the star. Without that pressure from energy, the star collapses in on itself, forming a black hole at the middle.
The outer parts of the star start to fall in on the black hole, but, like most stars, this one is probably rotating slowly. And, just like a figure skater who can spin up to tremendous speeds by drawing in her arms, the slowly-rotating star speeds up to a tremendous rotation of gas falling into a black hole. The black hole can't swallow all of this rotational energy, and it begins to spew material outward in narrow beams moving at nearly the speed of light. These beams of particles burrow out of the star and run into gas and dust in the space surrounding the star, where the violent collisions produce copious amounts of light in the form of gamma rays, X-rays, and even optical light.
Meanwhile, what is left of the star continues to collapse under gravity, but the stream of particles from the very center of the collapse causes the implosion to "bounce" outward, ripping the star apart in a cataclysmic supernova explosion. The supernova material moves much slower than the speed of light, so it appears to us on earth only a few days after the gamma ray flash.
This model does a nice job explaining everything we know about the long gamma ray bursts. It's not a perfect model, and there are still many holes in our understanding, so it would not be surprising if the true details are quite a bit different. But that is how astronomy often works -- theories are developed to explain an observed phenomenon, those theories make new predictions that can then be tested with new observations, and then the theory is either disproven or shown to be in need of some revision, and the cycle continues.
In the meantime, we still have the ever-mysterious short gamma ray bursts (which may be giant star quakes on neutron stars, or colliding neutron stars, or merging black holes, or something even more exotic) to study, and even the long gamma ray bursts continue to surprise us with complexities we never imagined!