How to trade with villagers?
Find a village and locate a villager with a profession (farmer, librarian, etc.).
Interact with the villager by right-clicking on them.
Browse their available trades by scrolling through the trade menu.
Choose a trade by clicking on it, and make the trade by offering the resources/experience required.
Repeat steps 3 and 4 to make additional trades or to level up the villager's trade options.