Introduction: How to 4gate in Starcraft 2

Starcraft 2 is a popular RTS (real-time strategy) video game.  It is based around 3 races; protoss, terran, and zerg.  Each race is unique and has different strengths and weaknesses and require different skill sets.  These races differ substantially while the game remains balanced.  In starcraft during the early game (the first 10 or so minutes) players use build orders, which are set orders of building and unit production that allow efficient grasps for certain goals.  Some builds are based around applying early pressure (rushing).  Some builds are based around making it to the mid-game safely (defending).  Some builds are based around making it to the mid-game with an economic advantage (being greedy).  Some builds are based around getting out a technology as soon as possible (timing attack).
4gate is a popular build that is most often used in PvP (protoss vs protoss) but is sometimes applied to PvZ (protoss vs zerg) and PvT (protoss vs terran).  It is considered a rush build, as it sacrifices early aggression in order to damage and possibly eliminate an opponent early game.

Step 1: The Build Order

*Note: All unaccounted supply is implied as probes
9 supply: Pylon
*Use initial 2 chronoboost on workers
12 supply: Gateway
14 supply: Assimilator
15 supply: Pylon
17 supply: Cybernetics Core
18 supply: Zealot
22 supply: Warpgate Research
*Use all remaining chronoboost on warpgate research
22 supply: Stalker
24 supply: 3 gateways
24 supply: stalker
26 supply: Proxy Pylon

Step 2: How This Build Works

This build is designed to get out a large amount of gateway units efficiently and quickly.  The attack hits at about 6 minutes with 7 gateway units.  It gives a steady flow of reinforcements for the first few minutes after the initial push.  It also allows one to retreat and defend one's own base safely against most pushes.  If the opponent is caught by surprise, they are unlikely to be able to hold it.  It is a quick and easy win if it works and nothing to be ashamed of if it fails.

Step 3: What Units to Warp In

During the offensive, the units one wants to warp in depend heavily on the situation.  It depends on one's opponent's race and composition as well as one's own preference.
Versus protoss, one should always have 2-3 zealots in front.  Then one should make as many stalkers as gas allows then make zealots with the remaining warp ins.  If your opponent has a lot of sentries, you want to warp in a lot of zealots on the high ground should you be able to get visibility, in order to force them away from the ramp, taking away their high ground advantage.
Versus zerg, one should make zealots versus zerglings and stalkers versus roaches.  If the zerg lacks a roach warren, one should have a zealot to stalker ration between 3:1 and 2:2, depending on preference and map.
Versus terran, if the terran has marauders, you want at least 3-4 zealots in front of the charge.  If the terran lacks marauders, 1-2 zealots should suffice with the rest of your army consisting of stalkers.  If the terran has 2 or more bunkers, more zealots may be recommended. 

Step 4: How to Control the Army

This part is quite difficult to put into words, but it is also extremely essential to making this build work.
One wants to keep zealots in front of the stalkers in the direction of the opposing army.  Should the opponent attempt to flank, send a corrosponding ratio of zealots to their army ratio sent to flank in the direction of the flank. 
If the opponent has roaches, stalkers, or marauders, one should attempt to target these units with stalkers.
One wants to keep zealots under the cover of the stalkers while still giving room for the stalkers to have flexibility.  The zealots should be in a line.  Versus zerg, the zealots should be in a crescent-esque shape, giving the stalkers the ability to fall in versus a zergling flank attempt.
The zealots should be kept apart at a distance that would allow stalkers to flow through them.  The stalkers need to be able to exchange positions with the zealots without getting out of position.  This positioning is not essential but makes micromanagement a lot easier.

Step 5: When to Pull Back

When to pull back can be a very difficult decision.  It also varies upon what race you are playing and the situation.
Protoss is the easiest race against which to decide to retreat.  If they have an advantage in numbers and your warp ins won't change that, it would be wise to retreat.  If the opponent has an immortal and a significant number of gateway units. it would also be wise to retreat.
Versus terran, one should retreat if the terran has a significant force of infantry with stim or bunkers.  It is vital that you ensure that the terran is unable to expand.  You should warp in sentries and contain them at the base of their ramp until you feel they will have medivacs.  Expand behind this and pull back when the feeling comes to you that they are about to drop and flank you.
Versus zerg, it is an extremely difficult decision.  You want to retreat while your army is only slightly stronger than the zergs.  If the zerg's army is at all stronger than yours, they will surround you and you will be unable to retreat.  If you retreat too early, then it is likely that one is too far behind in economy.  One cannot afford to lose one's whole army against zerg.  They will then get too far ahead in economy and the game will be an uphill fight.

Step 6: What to Do After the 4gate

This depends on the match-up
Versus protoss, one should do what one's opponent is doing.  If the opponent is expanding, expand.  If the opponent is teching, tech.  If the opponent is counter attacking, amass gateway units at one's base.  One must be avid with scouting at this part of the game.  Unless one killed 5 or more probes, one is likely to be very far behind in economy.  One must play on the basis that they are a better player and give the opponent room to make a mistake.  If the tech route is chosen, the tech one choses depends on personal preference.
Versus terran, one should perform a sentry contain at the base of the terran's ramp in order to delay an expansion for as long as possible.  One should take one's own expansion during this contain.  Once the terran gets out medivacs, one should retreat immediately.  Knowing when medivacs are out is a 6th sense, there's no real knowing when they will be out.  If they drop behind one and one has not retreated, one will lose their whole army.  If one retreats too soon, the terran will be given a lot more room than one should be comfortable with.