One main point to take for the analyses is that photons are bosons, so they don't interact between each other, which makes optical switches a pretty hard thing to do.
What we do is using interference to make a switch. More specifically, we use an apparatus called Mach-Zehnder interferometer (combined with a phase shifter) to manipulate the light.