Gates are usually doors through fences, hedges or outside walls. Sometimes gates are used at the top of stairs or in doorways. They control the flow -- who is allowed to go through? For instance, a gate allows people to go through a fence while when closed, it still keeps pets and young children safe.
Gates can be designed so you can see who's on the other side or as part of a fence that blocks the view of people outside for privacy.