Istanbul: exited the port, walked through the taxi stand, and turned right on the first street. You can see the tram line running down the middle of the street.
After walking about a block from the port along the sidewalk, between the tram line and a waterfront park, we came to the Findikli tram stop. (I believe you could also turn left from the port and hit a tram stop pretty soon, but I don't know that one's name.) There is a metal stall marked "Jeton" where you buy the tokens. The Findikli stall is in the middle of the street between the tram lines, but some other tram stops have their stalls on either side of the street. Buy your token, then enter the turnstile by putting the token in the slot.
The tram is very efficient and inexpensive, 1.30 new Turkish lira (YTL) per ride. Trams heading towards the port into town are marked "Zeytinburnu". Ones from town to port are marked "Kabatas".