Resources are gathered by the three main resource buildings: timber camp, clay pit and iron mine. Additionally, you can loot resources by attacking other players and barbarian villages. Please note that this setting might be disabled on some worlds (so-called "no haul" worlds). If the setting is active or not can be seen in the settings overview of that world. Moreover you can gain resources by scavenging. From your rally point you can send your troops away to scavenge for resources surrounding your village. The units will return when they collect enough resources - but have in mind once you send the troops away you can't recall them. Scavenge is not active in every world. To see if it is, simply check its setting's overview.