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.