Usually, these things are left by accident and can be found sitting in secret areas or brought into being via console commands.
For the case of many of Bethesda's games, they even leave traces of these cut ideas in the game.
Sometimes they are able to save the ideas for future DLC or games, but there are always things left behind on the cutting room floor. With any big video game project, there are a lot of ideas that do not make it into the game.