score:7
Check out the Berlin Airport Public Transport Page
S-Bahn Trains are your best bet (these run every 24 hours at 30 min intervals at night on weekends)
S9 every 20 minutes (Pankow – Schönhauser Allee – Ostkreuz – Schöneweide – Adlershof – Flughafen Schönefeld)
S45 every 20 minutes (Südkreuz – Neukölln – Baumschulenweg – Schöneweide – Adlershof – Flughafen Schönefeld)
More information from the S-Bahn website
Alternatively you can take regional trains or bus
More information on buses on the VBB website
Try visiting those websites and running a query with the exact date you plan to travel with arrival time of 5am. Catch is you need to enter the place you are traveling from. This might help you decide where to stay. But from my experience catching S-Bahn trains around the city center is easy.
Upvote:1
Some S-Bahn/U-Bahn lines operate all night long, at least on some days, and there is also a network of night buses. Otherwise, the regular S-Bahn service starts at 04:30 so depending on where you are staying the first S-Bahn (perhaps combined with a bus) could be the solution.
In addition to all the resources mentioned by EdmundYeung99, you can simply use the BVG journey planner to find a route. It works just fine even for night buses, regional trains and S-Bahn trains even though the latter are not operated by the BVG.