What usually throws people in this situation is conflicting control schemes. People think "If the motion sensor throws the light on, and I throw the light switch off, it should go off". But if you can live with the "either/or" arrangement, turn the switch off and the light stays on because the motion sensor wants it, then this is easy.
Start by re-marking wires; this will make life much easier.
You'll need black and red electrical tape. Get a 5-pack of colored tape for $4-5.
- Black = always-hot
- White = neutral
- Red = switched-hot
The black wire on the lamp itself should be re-marked red. If the lamp is a spur line (i.e. it's not a switch loop), then /2 cable will suffice, but re-mark the black wire red on both ends, since it will be switched-hot.
Cable sizes must match what is already in the garage, and 12 AWG=20A breaker, and 14 AWG=15A breaker.
Also note that since 2011, plain switches need always-hot, switched-hot and neutral, so black, red and white needed there. The motion sensor will need the same.
At this point, you cable it up in whatever way the wire routing best lends itself. You need to connect the wall switch, the motion sensor, and the lamp, any way which proves most practicable/economical. Think of that as a triangle, with power coming in any one corner. You are only allowed to cable 2 sides of that triangle.
- Supply gives black and white.
- Switch needs black, white and red.
- Motion sensor needs black, white and red.
- Lamp needs red and white.
So "connect the dots" as it were. Some places will need all 3 colors, perhaps some only two. If you have a segment that only needs red and white, you can use /2 cable and recolor the black as a red. You shouldn't have a segment that needs only red and black.
Now, if you're in an old-style (2-wire) switch loop, first, you must replace that cable with a /3 cable if that is possible. If unable to replace, then tag the black wire red, and the white wire black, due to an NEC requirement.
The motion sensor is an interesting one. They have 2 blue wires, which go to the relay... that makes sense. Remark one of the blues black, and the other red.
Wire it up
Due to our care in pre-marking wires, this is simplicity itself: at each box, connect blacks to each other, whites to each other, and reds to each other. And we're done.
Wow, that was easy. This is why we did all that remarking before. I love my colored tape!
As to how specifically to wire it, I can't tell you how, because I don't know which cable routes are easier than others, and I don't know where the power is coming into the system. However, you can draw it yourself. Here.
- You're not allowed to make a triangle with cables. So Scribble out one of the three cables, you can't use it.
- Figure out where you want power coming in (based on what is easiest to run the cables to), and draw in a "cable" to that box and extend the black and white "wires" to it.
Staying inside the cables, connect all the whites, blacks and reds.
Each segment should now have 2 or 3 wires, depending. If any have 2 wires, and one is red, re-mark a wire with tape to be red.