Dismissing a companion is typically a temporary thing that you can do whenever you want and as often as you want. You can go solo or change your mind about your companions as many times as you wish. However, there are some caveats.
If your companions don't like the things you're doing (ie, they're "good" and you're doing "evil" things, or they're NCR-friendly and you're helping the Legion) they may give you a warning, and if you continue, they may leave permanently. In some cases you can avoid these conversations by not ever speaking to them. However, this will prevent you from dismissing them, as talking to them would cause them to leave permanently.
When dismissed, companions will return to their homes, or to the Presidential Suite of the Lucky 38 if you've got access to that via the main storyline missions. Note that their homes are not always where you found them originally - Raul, for instance, doesn't live where he is found by the Courier. There will usually be a notification about where they are headed when you dismiss them.
DLC companions are a special case - they cannot leave their DLCs to return to the Mojave with you. Likewise, you can't take the main game companions into DLC.