Many of the comments here remind me of the old question about the difference between a businesman and a buracrat...
"A buracrat has a rule book and provided he never breaks the rules he is safe. A businesman however can only survive the competition by breaking the rules."
In reality to prosper both need to "bend the rules" it is to what degree and "where the buck stops" that realy matters.
As noted by others above a good accountant is worth the price they charge for two reasons. They knows the legitamate tax avodence systems and secondly and possibly more importantly they know what the current taxman "norms" are.
The "norms" are the real rules of the unstated game between the taxman and the businesman...
Put simply the "norms" are what the taxman thinks an "reasonably honest business" in a particular market sector should be showing. If your business fits in with the norms for that sector then it is unlikley to receive an investigation (unless evidence of dishonesty is presented). Go outside the norms in either direction or have unhappy staff with a grudge then expect an investigation.
As the old saying goes "if it looks like a duck, waddles like a duck, quacks like a duck, why would you think it was a goose?"
Of course these "norms" cannot distinquish between an honest and dishonest business only a "real full audit" can do that and the cost is usually enteirly disproportianate to any gain so the taxman needs the "norms" as a yardstick.
Setting what the "norms" are is the game, and it is by understanding this that the sometimes strange behaviour of the taxman should be viewed.
In an established sector the traders will by gently pushing the bounds, over time they will have moved the "norms" in their favour. Which is "obviously" not in the revenue or treasury serivces interests, nor their political lords and masters who need the taxes to do "worthy work / bribe the electors".
Which is why every so often the taxman will pick on a particular market sector and hit a few busineses with a real full audit, and then pillory anyone who cannot defend themselves up front.
A couple of public show trials against those who cannot defend themselves and the revenue service theory is the "norms" will move back in the their favour (and those above them either are disinterested or implicitly agree with this behaviour).
Unfortunatly for most revenue services this game nolonger works for multinationals etc who often pay considerably less than 3% on any real profits (as a token gesture only). This is simply because once a business is above a certain size it has the ability not only to defend it's self up front, it also knows that the revenue service has a number of significant weekneses which it can exploit if a word in the right ear does not remove the problem.
Unfortunatly the revenue services know this only to well, and when it comes to the draw they blink virtually every time. Usually this is because they know that their political lords and masters won't back them with the required resources.
Knowing the rules of the game can help you.
As an honest small business stay within the "norms", keep your staff happy and have the right accountants. When you get a normal revenue audit have a "little something" for them to find plead an honest mistake and make immediate restitution and ask the revenue auditor for advice on how to avoid making this mistake again. This is based on the theory that "to err is human" and if they don't find something they are going to keep looking as you are obviously not super human therefor you must be covering something up...
If you do get randomly selected for a "real full audit" they will probably find something serious (this is the consiquence of an overly complicated taxation system). If they do either negotiate with the taxman immediatly pleading an honest mistake or fold the business in a politicaly damaging way and start again in a new juresdiction.
As an independent entity you are out on your own and simply do not have the resources to spare to fight. The taxman knows this so will just use you as an "example" to be publicaly abused to keep others in line.
The exception to this is when they are usuing you as a "test case" to set their agender (over that intended by the law makers). They won't negotiate except to string you along to get more evidence, and if you chose to fight they will rack up the costs etc to frighten you into pleading guilty thereby setting their interpretation of the law.
There are three ways of dealing with this.
The first and simplest is not to be a worth while target in that you have no assets etc and you simply fold and walk away before they get started.
The second is to be part of trade associations etc who have the resources, legal contacts and can motivate the market sector in your favour with lobbying and media preasure on the revenue's political lords and masters.
The third and most difficult (for a small business) is what large businesses do which is be a source of revenue for the political party that is currently in office. A well placed "word in the ear" from a political lord and master usually stops problems well before they get going.
If you are a medium sized business then you have additional problems, in that not only are you a potential target for the authorities you are now a target for other businesses either to be taken over or to be forced from the market place.
The sensible stratagy especialy if you are in a "high tech" industry is to not have all your eggs in one basket.
There are many ways of doing this but the simplest is to have more than one legal entity.
The entity that trades has no viable assets (property and plant) and assumes all the liabilities. It only legaly trades via "one way" connections to other entities.
For instance it can raise capital by using it's IP assets (Patents etc) as security against a loan from an entity in another juresdiction, effectivly moving the asset away from potential preditors whilst also allowing for "tax efficient" trading. That is if the loaning entity is in say a tax haven or low tax zone, as the trading entity can lose all expected profit via repayment and interest on the loan.
Importantly though if both entities are effectivly owned by a parent organisation the trading entity can be used to take any hits. As such it is like the leaves on a tree the loss does not kill the host. How you do this is subject to what you find moraly acceptable.
In Europe for example you are almost positivly encoraged to trade in this way by the simple fact that although there is a "common market" amongst the member states taxation and development grants are a matter for each state.
So for instance one smallish country has high rates of VAT (sales tax) that it uses to provide business development grants. All sales from that country into the rest of Europe means that it effectivly gets a backdoor grant from the other member states, which is one of the reasons that software organisation have their trade entities based there.