A hard fork is something that happens when some of the nodes on the network follow a new set of rules that are in some way incompatible with the existing set of rules. It occurs upon mining the first block that is valid under the new rules, but invalid under the old.
The software following new rules is deployed and in place before the fork occurs, but doesn't actually start using those new rules until some triggering event. In practice, this event is when a certain percentage of the last X blocks have been mined by nodes supporting the new rules. This event is called activation of the new rules.
The fork, however, doesn't occur until a block is found by the nodes following the new rules, that is invalid to blocks following the old:
[E] [E'] <-- Hard fork occurs when this block is mined
[B] <-- "forking" nodes start following new rules here
Here we see an example where the nodes following the new rules activate at block
B. However blocks
D are valid under the new rules, and the old rules, thus they don't cause the fork. When block
E' is mined, it is only valid under the new rules, meaning that it is rejected by clients who follow the old rules. Those clients that reject the block go on to mine
E, and we now have two irreconcilable chains.