There are basically three aspects to wiring:
1. What wire to use.
2. How to connect things up.
3. How to route the wiring.
The wire to use (or more correctly the size of wire to use) depends upon the current it is to carry (which varies with gauge) and the length the wire needs to be.
How you should connect things and how to route the wires varies according to what equipment is in your railway (or might get added in the future).
Firstly lets make two categories of model railway (from the wiring perspective):
1. Layouts which contain (or might in the future contain) electronics such as integrated circuits or latching elements such as flip-flops. All DCC layouts fall into this category. Layouts running BC3 and plan for 'higher layer control' are also here.
2. Layouts which contain none of these. Most classic layouts fall into this category. Layouts running BC3 and will never have any higher levels of control are here.
The second category is the simplest and can be dealt with first. There is also a plentiful supply of advice in books that show how to build model railways.
Track wiring is the most obvious and here you have a lot of choice. Most advice suggests using 7/0.2 wire (seven strands of wire that are each 0.2mm diameter). This is ample for all but the largest of scales (larger than 'G') and should suffice for even monster layouts.
Smaller scales (OO/HO and smaller) could escape with thinner wire - I use standard ribbon cable (7/0.127) for my N gauge layout, and thats with old locos that are poorly maintained (some draw around 500mA). Even fairly long runs (9m) work fine. Modern locos draw a lot less current and so thinner wire is acceptable.
If you want to run multi-heading with old cranky locos, then perhaps you should choose the 7/0.2 wire instead.
If you drive solenoid motors directly from your control panel, then be aware that long cable runs cause a voltage drop. When calculating such a drop, assume that the motor is drawing 5A. Having said that I have successfully driven solenoid motors using 9m of standard ribbon cable from a standard CDU. If you want to drive several motors from a single stud, switch or relay, then either give each one a separate wire, or use the thicker (7/0.2) wire.
The only considerations when routing your wiring is tidiness, and being able to follow the wires later. If your wiring isn't self-documenting (wouldn't that be nice) then grouping associated wire into bundles might help, and within each bundle make each wire a different colour.
Further advice on classic railway wiring can be found in railway modelling books.
These layouts are somewhat different to the classic case. The main difference is that they contain elements that might be susceptible to poor power feeds, noise pickup or the like. Consider the following circuit diagram:
The biggest source of problems is probably the earth, ground or return wire(s).
In this simple circuit we have a CDU driving a solenoid point motor, and a power supply feeding some kind of logic (perhaps an RPC stack). As is not uncommon, everything is grounded to a master ground (which might or might not be separate from the track common return). Some kind of input (labelled sensor) feeds into the logic circuit. Assume that the input device has its own power supply for the moment.
The ground wire has some resistance. Lets assume its a 7/0.2 wire and its 2.5m long (quite a short piece for lots of railways. Its end-to-end resistance is 0.2 ohms.
Now we activate the solenoid motor. For a few milliseconds around 5A flows (its a slow-rise pulse because of the inductance, and then the capacitor is discharging, but 5A is a good estimate). Along just this ground wire 1 volt is dropped (5A * 0.2ohm). Now for the solenoid motor it is of no concern, but it has the side effect of raising the ground level on the logic block by 1V.
That 1V rise in ground could easily make the logic erroneously detect a 'low' level from the sensor, or perhaps make the logic do something crazy. Either way it doesn't make for a reliable railway. If the ground wire were 10m long then ground on the logic would rise 5V!
The solution is simple: separate the ground lines:
Now any voltage drop on the point motor circuit is isolated to just that circuit, and will obviously not cause a problem (unless we get pickup of radiated signals).
There may be a reason (though probably not in this example) for both ground lines being at the same voltage. That's OK, but you must tie a single point of each ground to a single star-connected common ground:
The connection to common ground could be anywhere on each ground wire, but each one should connect just once (otherwise current will try to flow through the common ground connections and make new voltage drops).
In general you need to separate things of different current consumption characteristics. A sample separation might be:
1. Track feeds.
2. Solenoid motors.
3. High current slow action point motors (Hoffman, Conrad etc)
4. Lights (scenic lighting, signals etc).
5. Logic, sensors and other low-power devices including Tortoise motors.
All of items 1..4 have the scope for affecting the logic circuits. Items 1..3 could affect the lighting, though that is unlikely to cause problems, but having lights flicker or dim when turnouts operate is probably not a good idea.