Liepaja is a city in Latvia.
East towards Riga
Walk in the direction of the Liepāja - Riga highway (read the traffic signs), it is a five minute walk. When you see a bus stop on that highway, you can start hitchhiking from there.
Another option is to go to the main bus station and take an intercity bus, because most of them have to pass Grobiņa on their way out of Liepaja. From there you have buses quite often, every 15 minutes or so. Check the schedule here. Tell the driver you want to get off at the second bus stop in Grobiņa, next to the Lats supermarket (Lats veikals in Latvian). This is the same bus stop as in the option 1.
South towards Palanga, Klaipėda
Take the tram in direction south (there is only one tram line) and get out at Baata shopping mall. Follow the main road straight until you get to the crossed out Liepaja sign here, it's a 15 minutes walk. Start hitchhiking from there.