여기 = here = next to me (to the person who speaks)
거기 = there = next to you (to the addressee)
저기 = over there = far from both speaker and adressee
in addition, 거기 can reffer to a place which both speaker and addresse know or which was previously mentioned in the conversation. like in the sentences - 'Do you remember the bar we went to on the last Friday? I've been there today' - you or your addresse both are not there at the moment of speaking, but you will still use 거기 as you refer to the place you both know and are talking about.
also, you can use 저기요 to politely draw attention of someone like stranger on the street, or waitress (comparing to the English "Hey, over there!", 저기요 is not rude at all).