Electrical wires are coloured specifically for it to be easy to identify their purpose.(re write) The colour determines what the wire does for the appliance & house circuits and how it should be treated. It also defines which port it occupies in the socket.
The three most commonly used colors are Red, Black and Green. Their uses are:
 Red:  The red wire signifies the phase in the circuit and is the live wire and cannot be connected to another red or black wire. It is often used as a switch leg, in which the wire comes from bottom terminal of the switch and when the switch is turned on, the wire becomes hot. It is the leg which can be used to turn the load on or off.( need to re write in simpler form)
 Black:  Black wires are neutral wires and the wire is connected to a neutral bus bar inside the electrical panel. The bus bar is a conductive piece of metal used for the purpose of distribution. The black wire can be connected to another black wire, and as it is neutral, it does carry a charge. The charge is the unbalanced load i.e. the return current which flows back into the electrical panel.
 Green:  The green wires are the grounding/earthing wires in the circuit. The green wire can be connected to another green wire only. The grounding wire is not meant for lights or fans and is used mainly for socket purposes such as in the case of AC’s, geysers and other heavy load appliances. Switches generally have only two wires i.e. neutral and phase. The green wire provides a path to ground for the circuit’s electric current as it connects to a large copper plate buried in the ground of the society’s meter box.
Understanding the colour coding of the wires is information one should take into account before handling them. The colour coding is different in each country, so it’s best to ask a professional first before taking a hands-on approach.