If you need a place to stay, the closest hotel is Avendi Hotel, Griebnitzsee, which is within walking distance (5 minutes) to the HPI.
Close to the Potsdam main station is Mercure Hotel Potsdam, from where the S-Bahn line S7 starts toward Berlin. To reach the HPI, take this line and travel to Potsdam-Griebnitzsee (6 min ride, two stations from Potsdam main station).
If you want to stay in Dorint Hotel, Potsdam to reach the HPI, take any bus with the destination Potsdam Hbf (Potsdam main station) from Reiterweg/Jägerallee (very close from the Dorint Hotel). At the main station, take the S-Bahn line S7 that starts there and runs toward Berlin. Take this line and travel to Potsdam-Griebnitzsee (6 min ride, two stations from Potsdam main station). Total travelling time is about 30 min.
Other hotel suggestions in Potsdam can be found here.
You may also look for hotel in Berlin and reach the HPI by the Berlin S-Bahn or train. Please check the Berlin S-Bahn website or the Deutsche Bahn website for connections to the Griebnitzsee train station.
Hotel suggestions in Berlin can be found here.