Trade
Trading allows you to gain resources simply by having your traders shuttle between markets or docks. Traders that travel over land can be trained at markets, and merchant ships that sail over sea can be trained at the dock.
(The following explanation refers to both markets and docks; “Market” is used for brevity.)
Establish a trade route between two markets by selecting a trader and right-clicking two markets one after another, setting them as “origin” and “destination” markets. Your traders will then start shuttling between them, gaining resources for every round trip made; You can choose which resource will be gained by each trader. The longer time it takes to travel between the two markets, the more of that resource you will get at the end of each round trip.
You can have a trader shuttle between two of your own markets, or between your market and an allied market. The latter case yields more resources per trip than the former.
Bartering
Bartering allows you to buy and sell resources in exchange for other resources at the market. Resources are traded at exchange rates that vary with each deal. For example, to purchase 100 Food, you may initially have to spend 100 points of another resource type (Wood, Stone, or Metal). By the next deal, however, Food will become more expensive. The rates are global, so if another player buys Food it will be more expensive for you as well. Over time, the exchange rate gradually resets to the default rate.