The two groups of Blue / Brown & Earth will be power coming in from wherever it comes in from - the previous ceiling rose - and power going out to the next ceiling rose.
These groups should be joined blue with blue - brown with brown Earth with Earth.
The wires Red & Black will run to the light switch - look inside the switch and notice the colours - their Earth should join with the other Earths
Of these two - The Red wire carries power to the switch so it should join with the two Brown wires.
The Black will be the switched live return - ideally it should have a short Red or Brown sleeve on it to show that it's a live wire rather than a neutral.
The Black wire should have a terminal block of its own.
The light fitting will connect with the Black - Switched Live on one side - and with the Blue wires - Neutral - on the other.
It may help your understanding to make a simple sketch of the circuit so you can see what's going on - what should be going on.
Clearly the house has been re-wired - either that or an amateur has installed the cable to the switch - Red & Black are the old wiring colours and Brown & Blue the International IEC standard colours since 2004.
Take care as you work and remember Lord Finchley...
Lord Finchley tried to mend the electric light
Himself. It struck him dead: And serve him right!
It is the business of the wealthy man
To give employment to the artisan.