Heidelberg has a decent public transport system. Check if your Student ID comes with a public transport pass. If it does, you can take public transit within Heidelberg after 7pm during the week and throughout the entire weekend and during public holidays with you for free.
Normal buses stop running around 00:00 - 00:30. After that, use the Moonliners. If you miss the moonliner on a weekday, then you will have to walk.
There are five Moonliners, which run special routes covering most of the city. You can get a map online or at the tourist office near the train station. The Moonliners all depart Bismarckplatz at 00:38 every night of the week, as well as 1:08, 1:38, 2:38, 3:38, and 4:38 on Friday and Saturday nights, plus a final 5:38 on Saturday. Normal buses start running again around 6am :) Wherever you are in the city, you can probably find a Moonliner that will take you back to Bismarckplatz, and another to take you home.
The best app to use the public transport services in Germany is the Deutsche Bahn App. It includes all public transport systems in Germany plus all train connections. For local connections the VRN (our regional public transport provider), app is perfectly fine.
In Heidelberg, one of the easiest ways to get around is by bike: it’s relatively flat and has many bike lanes. However, please be aware that you are not allowed to ride your bike on Hauptstrasse. If you need a bike, or if your bike is broken, check out the following places:
Ruprecht Rides (Hans-Bunte-Straße 6, Eppelheim)
Cheap bike store run by students. Mainly focusses on second hand bikes.
Rad Point (Untere Neckarstraße 64)
Conveniently located close to Marstall.
Fahrradhof bike im Bahnhof (Heidelberg main station track 1b)
They have a repair and rent service with some bikes to buy, too.
URRmEL (yellow container at INF 710; http://urrmel.uni-hd.de )
At URRmEL you can fix your bike for free with the help of the stuff. They have some spare parts for free, too. This service is supported by the university