Here is a basic explanation of how the economy works:
-Villages produce goods based on what types of production they have in place (e.g. Sheep farms produce sheep, cheese, wool etc.)
-Peasants take goods produced in their village to sell in the local town by repeatedly travelling directly between the village and the town on the map.
-The raw materials are taken to towns and either consumed or processed into secondary goods (e.g. wool into clothes, sheep into meat) via workshops.
-Goods in towns are bought by caravans to be sold elsewhere for a higher price, caravans will assess the situation and try to maximise profit from their journey over the map.
When all of these steps are completed successfully, the prosperity of the settlements increases. What's interesting, though, is that because everything is connected in this way, disruption can be a very effective approach when dealing with an enemy or rival. A simple example is that raiding enemy villages or preventing peasants from making their journey to the local town impoverishes towns due to their lack of goods to process for trade. More indirect benefits can be received by, for instance, aiding a bandit group near to the fief of a rival noble from the same faction, trying to limit their income and gaining a leg over them in the faction standings. Since everything is simulated in this way, no matter what you do, it has a knock-on effect in the world. Manipulating this to your own ends is key to making progress in the game but AI Lords will also attempt to create problems for opponents, in an effort to better themselves.