Summarize:

You can build a gate from any type of wood. You can do so by right-clicking (PC) or pressing L2 or Z2 (console controller) the crafting table. Here's how:.  Place one plank in the 2th square (the one at the top-center). Place another in the 5th square (right below the other plank). Drag the stick to the inventory. The 5th square is at the center of the grid. Place the second plank right beneath it (the 8th square). The planks must be surrounded by sticks on the right and left sides. Your gate is ready to be placed.
Gather four wooden planks.You can either collect planks from villages or craft them from a single wooden log. Open the crafting table. Craft two planks into sticks. Place planks into the 5th and 8th squares. Place sticks in the 4th, 7th, 6th and 9th squares. Drag the gate to your inventory.