Distance vector routing works by having each node maintain a routing table with the minimum distance to reach every other node. Nodes share their routing tables with immediate neighbors periodically or when changes occur, allowing each node to learn optimal routes throughout the network. Each node sends only the minimum distance and next hop information to neighbors, who update their own tables. This sharing of routing information allows all nodes to gradually learn the least-cost routes.