If I research Sailing, will my cities be connected?
No. Hanoi does not have a coastal connection.
If yes, do I have to road some coastal tiles (i.e. the gold & wheat ones) for that to happen?
No. What you need to do in order to connect your trade network to the coast is to build either a city or fort on the coast, and connect it to your trade network. Coastal cities/forts can access the water for trade routes, landlocked cities/forts cannot unless they are next to a river that leads into the coast.
Does Sailing enable trading via all possible coastal tiles of a whole continent? For instance, I know X & me share the same landmass, though the coastal route is still unexplored. Can we trade?
Sailing permits your trade network to expand over rivers and coastal tiles that are explored and not covered by a hostile culture - barbarians or any rival civ you are at war with. Note that you do not need open borders to trade
through a rival civ, you need open borders to trade
with a rival civ and explore their territory. In addition you don't need Sailing to trade across rivers or coastal tiles that are within your cultural borders.
Example 2: I'm connected to Y through land route, and Y connected to X through water route (though I don't know that, not explored yet). Only I have Sailing. Can I trade with X?
No - you need to have a safe route explored in order to send traders across it. If you don't know where places are or how to get to them, your traders will not be able to trade there.
Overall, I'm still confused about how the game determine trade routes. Many times I see the 'connected' icon next to a civ, but when I open border, no foreign trade happens. It's early game, so civics like Mercantilism isn't available yet.
Being connected means that you, the AI or both have established a connection between your respective trade networks. That connection can be one way, I.E. the AI has scouted out a coastal route that you haven't uncovered, and so the AI is able to reach and trade with your cities, but your traders don't know how to reach the AI's cities. This will give you the connected icon next to the civ, since you are connected and able to trade resources, but in order to get trade routes with the AI's cities you must uncover your own route to those cities. Otherwise opening borders only allows the AI to trade with you.