She wanted attention
...and why did the rest of her outfit change at midnight, but not her shoes?
It was a glass slipper,hard to keep on.
In order to make the story work. If it hadn't fallen off, the prince wouldn't have found it, and he probably would have gone to his den and watched TV the rest of the evening. End of story.