Recessed lighting often comes in groups. The lights are spaced based on the amount of light desired and the area being lit. Each light shines a circle of light towards the floor, and by overlapping the circles, it provides sufficient area lighting. In some locations, dimmer switches control the level of lighting; other areas just use standard on/off switches, depending on need. Connecting the lights together and to the switch or switches is fairly easy and safe to do.
Turn the power off to the circuit you will be working on at the circuit panel. Verify it is off with a no-contact tester.
Run sheathed cable from light to light. Use cable staples to route the cables and keep them from touching the outer shell of the recessed lights. Remove a knockout for each cable that will enter the fixture box. Strip 6 inches of sheathing from the cable, and push the cable into the box through a knockout hole until about 1/4 inch of sheathing on the cable is inside the box.
Run a cable from the last fixture to the switch, strip the sheathing from the ends and insert into the boxes, making sure at least 1/4 inch of sheathing on each cable enters the box.
Remove the covers from all the fixture boxes. Each cover is held in place with a spring or a screw. Connect all the ground wires together in each fixture box. Twist solid bare grounds together with pliers, and connect them to the green ground wire from the box with a wire nut.
Strip 3/4 inches of wire from the ends of all the black and white wires in each fixture box. The solid wires from the sheathed cable should be twisted together with a pliers. Connect the white wires first. Twist the solid wire ends of the wire together, and connect them to the white fixture wire with a wire nut. Connect all the black wires in the same way.
Replace all the covers on the fixture boxes.
At the switch, connect the bare ground wires together and to the switch ground screw. Connect all the white wires together, and cap with wire nuts. Connect the black wires to the switch terminals according to the type of switch being wired. Attach the switch to the box with screws, and add a cover plate to finish the job.
After stripping the sheathing from the cables, insert the wires into the boxes through the knockout holes. Six inches of wire will be inside the box along with 1/4 inch of cable sheathing. The knockout holes for sheathed cable are shaped like the cable and have a slot for a screwdriver in them. Insert a flat head screwdriver into the hole, and bend the knockout tab out. Grasp it with a pliers and bend it off. Cable staples should be used on each piece of cable to control it. Each cable should be fastened within 12 inches from where it ends at the fixture box and every 4-1/2 feet. Leave a little slack for yourself, but do use the cable straps or staples.
This procedure is easy and safe enough for anyone to perform. However, if you are not comfortable working with electricity or remain unsure of how to proceed safely, stop and get help or hire a professional. Working on the wiring in your home exposes you to potentially dangerous and life threatening electrical current. Always follow safety procedures; turn the power off and check to make sure it is off. Always check the circuit with a tester to make sure the power is off before beginning work. No-contact testers require that you only bring them close to a wire to detect current. Invest in a good no-contact tester.