Using Kaluza-Klein theory we discuss the quantum mechanics of a particle in the background of a domain wall (brane) embedded in extra dimensions. We show that the geometric phases associated with the particle depend on the topological features of those spacetimes. Using a cohomological modeling schema, we deduce a random phase sequence composed of the geometric phases accompanying the periodic evolution over the spacetimes. The random phase sequence is demonstrated some properties that could be experimental verification. We argue that it is related to the nonlocality of quantum entanglement.