That whole "Ra was an Asgard prior to his discovery of Earth" hypothesis is BS fan-fic. Never happened. In SG-1, prior to the Goa'uld having human hosts, they used
Unas. While they mentioned that the Goa'uld had used various alien species, they never showed them using anything but humans or Unas (except for an episode where they were stuck in a ziggurat and the Goa'uld jumped into a non-sentient critter to survive).
So, about 25 million years ago, the Alterans (ancient humans) are living in their home galaxy. Some of them are into science. Some are into religion. The religious ones become zealots and start indoctrinating anybody who doesn't follow their religion, known as Origin. Some Alterans, living like Amish people, build a big spaceship under their village and leave their home galaxy so they can live their lives like they want. They end up in the Milky Way.
One of the first things they invent is the StarGate. In order to build out their StarGate network, they build big autonomous ships that are able to scoop up resources and build gates, then place on planets, or in orbit, throughout the galaxy. Later these ships leave the Milky Way and continue on their way, seeding StarGates in all the nearby galaxies of the Local group and beyond (this is where StarGate Universe comes in). The original StarGates aren't as advanced as the ones from the series; they don't have the range to cross an entire galaxy in one hop, so they're later upgraded to the ones seen in the movie and SG-1.
Later, the Alterans in the Milky Way are struck by a plague and mostly wiped out. The show never really explained where this plague came from, but the writers dropped a few hints to insinuate that it was a Prior Plague; priors being the Alteran religious nuts that drove their kind out of their home galaxy. Like I said, the plague wipes out most of the Alterans in the Milky Way. Many Alterans ascend to become "The Others", ascended beings of immense power (think Obi-Wan Kenobi after Vader kills him). The Others shield the Milky Way and other galaxies from the influence of the Ori, who are other ascended beings that created the religion the Alterans tried to escape from.
The Alterans who survive the plague, but aren't ascended, become known as the Lanteans. These are the folks that create the big city-ships like Atlantis. Apparently this plague wipes out most sentient life in the galaxy, so the Lanteans build
a huge motherfucking Macguffinto "seed the galaxy with life". This is what changes primates on Earth into the second evolution of humans, a.k.a., the Tau'ri, a.k.a., humans.
Apparently the Lanteans get so good at creating sentient life that they decide to leave the Milky Way and start spreading intelligent life to other galaxies. Their next [known] stop is the Pegasus galaxy, which is a dwarf galaxy orbiting the Andromeda galaxy. They get there, create another Macguffin life creator gizmo, and create a bunch more human species (the Athosians, the Genii, and many others native to the Pegasus galaxy).
Eventually some Lanteans discover the Irratus bugs, which are these big nasty bugs that feed on a persons lifeforce, but have the ability to utilize their prey's DNA to become better predators. These evolved bugs become the Wraith, which are, for lack of a better term, space vampires. The Wraith end up becoming the Lanteans biggest threat, and a war breaks out between the two that lasts 100 years, give or take.
During this war, the Lanteans create a nanotechnological weapon to attack the Wraith, but this nanotech ends up evolving sentience and, later, humanoid form. These guys start calling themselves the Asurans. The Asurans don't want to be a weapon, and they think of the Lanteans as weak (the Wraith can't feed on the Asurans because they're technological), so they basically say, "Screw you, Lanteans!"
The Lanteans ultimately lose the war, and a small contingent that were stuck on Atlantis after they sunk the city (for protection from the Wraith) decide to evacuate back to Earth about 10,000 years ago.
Some Lanteans that return to Earth apparently decide to stay here and help out humanity. They mingle with the natives, which is why a small percentage of humans (like Colonel O'Neill and others), have the Ancient Technological Activation gene, which allows them to use ancient technology and interface with their libraries. Some of the returning Lanteans decided to leave Earth and see what had changed. The ones who left are the ones who met the Asgard, Furlings, and Nox, creating an alliance of four "great" races. Another one of these guys, named Janus, created a timeship, which would allow SG-1 to save Earth in one of the more fun season finales. Another one created Reese, who was a simpler version of the Asura. Reese ended up creating "toys", which later became known as the Replicators, the future bane of the Asgard.
Then you have Merlin. Apparently he was an ancient, hanging out with King Arthur and the bunch, trying to boot the Goa'uld and other bad guys off Earth, but also preparing them for the inevitable Ori invasion. Apparently the ascended Alterans had a policy of non-interference with lesser beings, so if the Ori showed up (which they did), they'd only keep the Ori ascended beings from wiping everything out. They wouldn't do shit to stop the sort-of-ascended Ori Priors from fucking everything up, however. This story arc was from season 9-10, and this is when SG-1 pretty much jumped the shark.
The ancients were the creations of Brad Wright and Robert C. Cooper, who started off just as writers and later became show-runners when they moved to Syfy. They wanted to completely recreate everything and tell a story about an ancient race of humans from another galaxy that can "ascend to a higher plane of existence", becoming beings made of energy with god-like powers. In other words, they were turning it into a metaphysical, spiritual war between good and evil, instead of a science fiction, action-adventure series. The further the show went on, the more they started ignoring the stuff set up in the early years of SG-1, when it was on Showtime and had different show-runners and better writers. Eventually Syfy turned it into "ancient macguffin of the week" series, with some callbacks once in a while to endear the old-school fans. Season 9 and 10 were mostly crap, with some cool nuggets that never went anywhere.
Like I said: total StarGate nerd here.