This prefab is a small test I was interested in doing. It works the same way as it works in Antichamber. If you don't believe me, you can always load up Antichamber and look at it for yourself.
The only thing I have not done with this prefab was to func_detail the steps but I have spent far too long on this already (4 hours making it).
I would strongly advise NOT to edit the core elements that make it work unless you really know what you are doing. You should only change the textures and connect your map to the hallway that is available once you go back (as seen at the end of the video).
How does it work?
When you spawn, you move towards the staircase. Once you are in front of the first choice, you can still go back to the spawn. However, once you have selected the blue or the red staircase, the loop begins.
If you selected the blue staircase and tried to go back, you would simply loop just as much as if you kept choosing the blue staircase moving forward. The same applies for the red staircase. Choice doesn't matter if the outcome is the same.
However, once you have been through each staircase at least once, when going back, things aren't always as remembered.
I originally made this test map for Half-Life 2: Deathmatch. While it works just as fine as in Half-Life 2, the only draw back is that you would see players teleport, which really breaks the effect.