There are many options when it comes to planting a tree, but the method described below works well in dry and mediterranean climates like Cape Town.
The best time to plant a tree is Autumn for trees native to winter-rainfall areas, or Spring for trees from summer-rainfall areas.
Step 1: The hole
Dig a square hole that is at least 3 times wider than the pot the tree was growing in. The hole should be at least 50cm deep, to accomodate the plactic pipe that will be used for watering and applying liquid fertilizers later.
Note that the hole should not be round, as this can sometimes cause the tree's roots to grow in a circle all around the edge of the hole in areas with hard or compacted soil. A square hole will force the root to break out into the surrounding soil when it reaches the corner.
Step 2: Initial watering
Fill the hole with water and wait for it to drain away. This will ensure that the surrounding soil is moist and that there will be adequate moisture available for the tree at root level.
Step 3: Install watering pipes and stake
It can be difficult for water and fertilizer to reach a tree's roots after it has been planted. So to make your life easier later on, this is a good time to prepare.
Get some round plastic pipes that are at least 5cm in diameter and 50cm in length. Drill evenly spaced holes in the bottom two thirds of the pipe. Place the pipes in the hole, ensuring that a short piece will stick out above ground level once finished. (After the tree has been planted, you will use these pipes to water and fertilize the tree more efficiently.)
If the tree needs to be staked, also place the stake in the hole now, so that the tree's roots will not be damaged if you push the stake into the soil later.
Step 4: Plant the tree
Add soil and compost until the hole is shallow enough that the surface of the soil will match the level / depth at which the tree was planted in it's pot. Mix compost with the original soil removed from the hole (use a 50/50 ratio of compost to soil).
Remove the tree from it's pot and place it in the hole. Continue filling the hole with the mix of compost and soil until it is filled. Punch the soil with your hands to ensure that there will be no air pockets and that the soil is firm around the tree. Some people will stomp their feet, but this may cause the soil to become compacted, so using your hands to firm the soil is a safer bet.
Step 5: Finishing touches
Tie the tree to the stake. The trunk should still be loose enough to sway in the wind without blowing over. Don't tie it so tightly that the tree doesn't move at all, as that discourages it from developing a thick, strong trunk and standing upright by itself when mature.
Mix a liquid fertilizer with water and pour it into the pipes. Continue watering and fertilizing the tree for the first year or two until it is well established.
Also apply a thick mulch around the tree to prevent the soil drying out.