A fence post set properly will outlast the panels hanging on it. One set badly will pull loose, lean, or rot through at ground level within a few seasons, and there is no repairing it afterwards.
Before digging anything
Check for services. Electricity, gas, water and drainage runs all cross gardens, frequently close to boundaries and frequently shallower than they should be. Use a cable and pipe detector, and be especially careful near the house, near a meter, and on the line between a house and a garage or shed.
Set out the whole run first with a string line between the two end positions, so every post lands on the same line rather than being adjusted panel by panel.
How deep
The working rule is a quarter to a third of the total post length in the ground, with 600mm the usual minimum for a 1.8 metre fence.
The hole should be roughly three times the width of the post, so a 100mm post wants a hole around 300mm across. A narrow hole gives the concrete no purchase.
Dig with straight sides rather than a funnel shape. A hole wider at the top than the bottom lets the concrete lift under load.
Drainage at the base
This single detail decides how long a timber post lasts.
Put 100mm of clean hardcore or coarse gravel in the bottom of the hole and set the post on that, rather than standing it on soil or encasing the end in concrete.
Water that runs down the post then drains away instead of sitting against the end grain. A post sealed into a concrete cup rots from the bottom up, because the concrete holds water against the timber.
Getting it plumb and in line
Stand the post in the hole, bring it to the string line, and check it with a spirit level on two adjacent faces.
Brace it with two timber offcuts screwed to the post and pegged into the ground at an angle, one on each of two faces at right angles. Hand holding a post while concrete goes in does not work.
Check plumb again after bracing, since fixing braces moves the post.
Concrete or postcrete
Postcrete is a dry mix poured straight into water in the hole, setting in minutes. It suits small jobs and single posts.
Mixed concrete at roughly one part cement to five parts ballast is cheaper on a long run and gives more working time.
Either way, fill in layers and compact each layer with a bar rather than tipping the lot in at once, which leaves voids.
Finishing above ground
Bring the concrete up to just above ground level and slope the top away from the post on all sides so rainwater runs off rather than pooling against the timber.
This is the second half of the drainage detail and it is skipped constantly. A flat or dished concrete top holds a puddle around the post permanently.
Curing before loading
Leave the braces in place and do not hang panels until the concrete has set properly. Postcrete needs a couple of hours before light handling, ordinary concrete considerably longer.
Check the packet, and add time in cold weather. Concrete gains strength slowly below about five degrees and should not be poured in frost.
Hanging a heavy panel on a green post pulls it out of plumb and nothing will bring it back.
Protecting cut ends
Any post cut to length has untreated timber exposed at the cut.
Treat every cut end with end grain preservative, and treat the buried portion generously before it goes in the ground. Pressure treatment guarantees frequently depend on this being done.
Cut the top of the post at a slight angle, or fit a post cap, so water runs off rather than soaking into the end grain from above.
Common mistakes
Holes too shallow, which is the main reason fences lean.
The post sitting directly on soil with no drainage layer.
Concrete dished at the top, holding water.
Working post by post down the run instead of setting out the whole line first, so the last panel does not fit.
Setting posts at panel width exactly, forgetting that the panel needs a small clearance and that concrete posts have a slot depth to account for.