The grounding wire is connected both to the switch using a pigtail wire and to the second cable run passing onward to the next switch. On the other end the two white wires are wire nutted together.

Wiring A 3 Way Switch
Black screw on light switch. You should also see a green. Observe the layout of the wires. The switch simply interrupts the current so it doesnt matter to which terminal you connect either wire. This type of switch lets you turn the light off or on from more than one place in the room. You could install regular lighted switch that does not requires neutral. If the switch box is metal it also must be pigtailed to the grounding wires.
You should see two black wires each connecting to a different screw on the right side of the switch. The black and red wires from the white cable running between the switches get connected to either of the two brass screws on the switch. It serves as the second hot wire in the switch loop. The black hot wire goes to the brass screw or into the hole in the back of the device on the same side as the brass screw. The white wire from the new cable connects to the fixtures hot wire terminal or hot wire lead and to the other screw terminal on the switch. The black wire from the new cable connects to the black hot wire in the fixture box and to one of the terminals on the single pole switch.
At this first switch the black feed wire is connected to the common screw on the switch. The black wire from the circuit breaker panel gets attached to the black screw on the 3 way switch. This wire is sometimes red. The black is power and the other two are called. That is called a three way switch. The only downturn is that it will be light when the switch is off.
Ideally the old switch is still there so you can wire the new one up the same way as the old one. Connect the black wires to the switch terminals. Its used in conjunction with another 3 way switch in another area and they both control a light or set of lights. A three way switch is different. These are called terminal screws. The green or bare copper ground wire if the device has one attaches to the green screw terminal on the switch or to the electrical box.
This type of switch has two brass screws usually on the bottom and a copper or black screw on the top left. If you only have black and white wire in the switch box that means there is no neutral coming in the box and unfortunately you can not install pilot light switch.