Given sufficiently god-like technology, you could run a simulation of the entire world repeatedly, modifying variables until you get a world with a copy of Sagan who fits exactly all the historical information available with him. Something like this is implied to be happening towards the end of Stross's Accelerando, which I highly recommend (there's a free ebook edition).
However, note my use of the term "god-like". Anything capable of doing this is so close to being a god that it makes very little difference from our point of view. There's also the theory that our universe is a simulation run by such an entity - the argument is something like "if it is possible to run a simulation of the universe, it is statistically far more likely that we're in such a simulation." Sort of makes sense, if you have the right mind-set or tilt your head and squint.