ok i will tell you what i know about it.
I don't know excactly how trade routes work (not the road/railroad ones either). but let's just assume we need our capital.
So you need a harbor in your capital (if your capital is not near a coast, then you can just build a harbor in another city, and connect the city to your capital by road)
then you can build a harbor to any cities you want a trade route too. Note that the water route has to be fully explored, and not blocked by barbs, enemy units, or other persons borders, also it may not be blocked by ice or land, obviously, there needs to be a route of passable sea (ocean only works if you actually have the ability to cross ocean)
so in short:
- Need a harbor in your capital, or connected to your capital
- Need a harbor in the city you want to connect to (you need at least 2 harbors)
- Need to have 'seen' a possible route to travel (you need to have seen all the tiles and verify they are actually passable, you can't trade in the fog)
- harbors can act as a 'transfer' to and from roads. (for example if you have and island that's so big that you can not go around it in any way, cuz both sides have ice, but you have 1 city in the east and one in the south, and there are several coastal cities, you can connect all the coastal cities with harbors, but 1 side will be left out, so you just connect the 2 closest cities (east and west) with a road, and then all the cities on the other side will suddenly also be on the trade route.