During rendering, materials can be computed for different types of paths such as global illumination, reflection, SSS, camera... This type of path are always defined by a ray type. Each time a ray is launched, it is set to the type of the path. For example, when launching rays to gather global illumination, ray types are set to GI (Global Illumination). The ray switch texture allows you to use different texture network depending on the ray type. For example, a texture mapped material can become fully red when reflected in the scene.
Sphere material becoming red when reflected
Detail of the sphere material
The ray switch can be very useful when it comes to optimize material evaluation. Indeed, by bypassing parts of the material texture network for specific type of rays, you can greatly speed up the material evaluation.
For example, you can use a ray switch to switch to a simplified version of the texture network when the path tracer is performing expensive computation such as global illumination, SSS.