Does not matter on the switch. Black / red switched, ground to ground connection on switch.
And red to black wire of light fixture, white to white, bare copper ground to green or ground.
What is going on is the "hot" wire is switched. If you touched this wire, you would be shocked. So you want the hot turned off by the switch and they have already wired it that way for you.
Then with a light fixture, there is a light socket. Two connections for the bulb. One connection is the inside center connection. This goes to the black wire.
So by connecting the red (hot) wire to the black wire on the fixture, you are connecting the hot to that center inside contact. This makes it safer to replace a light bulb. You could not accidentially touch that center contact as you might by touching the outside metal screw in part.
The following picture shows a lamp socket and similar wiring...