Get yourself a mains-tester screwdriver with a neon lamp in the handle (about £1). Remove the fuse or throw the circuit breaker for the light circuit. TAKE CARE.
A ceiling fitting will have Mains Live (RED) coming in and usually Mains Live (RED) going out to the next fitting unless it's the last fitting in the circuit and another RED wire going off to the switch. The Red wires all connect together and are permanently live and dangerous.
There will be the same number of Black wires as there are Red wires. Leave them all hanging in the air and not connected to anything and not touching one another or anything else. One of these Black wires is not what it appears to be!
Restore the power and carefully check with the mains-tester screwdriver that the red wires are live. Touch the blade tip against the Red terminal and observe the neon glow as you physically touch the OTHER END of the screwdriver (the top - it's quite safe).
Now very carefully touch the screwdriver tip against the copper of each of the black covered wires. One of them is the return from the switch and should ideally have a red sleeve around it to indicate that it's Switched Live (Switched Line). If no black wire makes the neon glow then operate the switch to the other position and check again.
When you have identified the black wire that's coming from the switch - remove the power from the circuit and connect that wire to the terminal strip together with the Brown wire that goes off to the lamp or lampholder.
The blue wire coming back from the lampholder connects to any remaining Black wires you may have - either one or more usually two. Restore everything and switch on.
In summary - the Red wires are all Live, Dangerous and connected together. One of the Black wires is sometimes Live and Dangerous but only when the switch says so and connects to flex Brown. Flex Blue connects to any other Black wires.
Septimus suggests a more elegant but more expensive solution - a meter and a long length of wire will cost more than a mains tester screwdriver - his way is safer though as you can stay well away from any live terminals.
Richard Buxton
September 2008