Making gates is really quite simple, all you need is a frame where you want your gate to be, and as many fences as the frame is wide.
(1) Make a frame where you want your gate to be.
(2) Put a row of blocks under the place where you want your fences, otherwise you cant place the fences.
(3) Place a switch on the block beside whichever block you chose to place the fences, it does not matter which side you put the switch on.
(4) Remove the blocks you had placed to put the fences down.
(5) Flick the switch and you have your gate.
Redstone can be used to power gates. Power a obsidian block that is under the block where you would normally put your lever.
Gates also work with nether brick fence, glass panes of any color including clear glass panes, and iron bars.
Original post by: dbizzzle