All the advice here is all well and good, but it's not really necessary, and some of them (like always taking Rationalism, or the NC start) limit your strategic options. If your focus is getting the tech for a space race before the time limit, rather than beating the AI on deity or something, you don't need anything fancy (and you certainly don't want to be relying on always getting a certain wonder). I'd focus on the fundamentals.
The key fundamental to good science production is having specialised science cities - two is usually a good number, three if you have lots of cities.
These are cities in locations with plentiful food, whose focus is building up science and population. If you can get these cities to be next to a mountain (so they can build observatories), that is a really significant bonus as well. These cities should be focusing on growth buildings (granary/watermill/aqueduct), and should build new science buildings (university/observatory/public school) as soon as they become available. One of them should also have the National College as soon as you're reasonably able to get it. Gardens and the National Epic are worth getting if you have the chance as well.
The most important thing - they should run as many scientist specialists as possible AT ALL TIMES.
Here's the thing: science really rewards being concentrated. Putting all your science eggs into a couple of baskets will pay off with really nice modifiers for every point of population in those cities. Additionally, science specialists give extra science points that also get these nice modifiers, but more importantly generate a whole heap of Great Scientist points. Two cities constantly pumping out Great Scientists will give you a lot of extra technologies that you can lightbulb, which will help you a whole lot.
This way you've got a couple of cities doing the work of many times their population; you don't need a big population empire for science post-medieval, really.
For your other cities, libraries are worth building everywhere - they're a very cost-effective way of boosting science. Universities on their own are not a priority investment though, as their real value is the specialists they allow you to run (they're better value if you're a way through the Rationalism tree). If you're not going to run specialists in a city, I'd probably only build a university there as a precursor to building public schools. Though if you go Rationalism, you'll probably want to consider more science buildings in more cities.
You asked about the tech tree; the top part is the part that helps you most. Education is a really important early milestone, as is Astronomy (both for observatories and caravels that let you meet more people for RAs). Scientific Method is also a big big tech booster. If there's not many AIs around that you can sign RAs with when you reach the modern era, consider going for plastics first and building some research labs - going through those late techs by yourself can be a big slog.