You would decide this on how much land you want to fence in.
What are you trying to do? Just a pretty Pickett fence around a garden, or a full blown privacy fence so your neighbors cannot see you in the yard?
There are lots of rules in various areas of the country that tells you how high you can make the fence, what type of materials you can use, what colors you can use and how far you can put it from the property line. This information will be found in the township that you reside in.
Also depending upon your area you may be required to call before you dig. This is a requirement in most city and populated areas where there are underground utilities. Even if you know exactly where the gas lines or the electrical lines are. If this is a requirement in your area and you can caught digging even a fence post without having them come out for free to mark you and your neighbors yard, you risk stiff penlites from the government.
In any case tell us a bit more about what your looking to do and many of us will be sure to chime in with some ideas.
Reading your profile, I see your looking to install a fence for the pooch, Depending upon the breed and their willingness to dig or jump your selection may be a bit difficult. Also if your just looking to keep them home, Have you looked into a electrical shock collar type? These work really well and dogs are trained quite quickly not to run through them. We use one our our dog gunner but its a hand held type. Hes a bit head strong but one zap and hes good for the day. Wife runs him with horses and keeps him from running after dear and coyote all the time.