On definitions
Technically, one-shot can mean different things to different people. It doesn't always literally mean a story that can be wrapped up in one session (though that is usually the goal). However, it does always refer to an adventure that is shorter than a full campaign which can vary greatly in length. For the purposes of this answer I will be using the following definitions:
- One shot - an adventure that can be completed in 1 session (generally 4-8 hours)
- Short adventure/campaign - can be completed in 2-5 sessions (4-8 hours per session)
- Long campaign - anything above that
Advantages of a short or one-shot campaign
Testing grounds for character ideas/story ideas/new rules/homebrew
The biggest advantage I have found in my experience running and playing both long and short adventures is that one-shots allow players to play a game and test out character concepts, story concepts, and/or rules variants that are risky or potentially untenable in a long-haul adventure. I've had one-shots turn into longer adventures when the concepts worked out and everyone liked them and also ones where we were happy we tried them out, but were content to stop them after the one-shot was done.
I've run many one-shots where we have tested out risky ideas. The one we are playing now is testing several homebrew rules (one is a neat skill check-based resolution mechanic) and several experimental characters (including me who is testing the new UA alchemist class). Using my character as an example, I never would have wanted to test it out if I knew I was going to be doing a long campaign because it means I would be stuck with a possibly confusing/bad/broken character for a long time or forcing the group to find some way to integrate a new character into the group as I replace it mid-story (we do extensive character work before beginning campaigns so it would be a hassle to say the least).
Great for introducing new players/DMs/systems without a lot commitment
Another really useful way to use one-shots is to introduce new players/DMs to a game. It usually helps, in my experience, to start out new players with a shorter adventure than a full campaign so that they can try an option, learn the rules, and then end the campaign and decide what they want going forward (with regards to character options and the RPG system in general). In particular, I have found this very useful when someone want to try DMing for the first time since they can do so without having the pressure to continue and to reduce the pressure of any mistakes they make.
Every new system I've run or tried with my group has been done as a short campaign or a one shot. We always run one to get a feel for how it plays and if we want to continue playing it. For example, I ran Masks (a Powered by the apocalypse system) as a 2-session intro game before having the group decide if they wanted to continue or not. I gave them a short story to complete but plenty of room to keep going. The group in this case decided to keep going, but easily could have decided that it was enough and to leave it at that. We have two new systems coming up that we are planning to do the same thing with. On the flip side, I've had a player at the table that was new and we started them with a full hardcover adventure in D&D5e. They made a character that didn't really fit, but they didn't understand enough to know that (or express it) and thus they ended up playing 15 levels and two years with a character they would have changed had we run a short adventure first to test things out.
When getting everyone to the table is a DC30 check
One shots are also very handy when you have a very busy group that is only able to meet sporadically. Having an adventure that you can start and finish in one session means that you don't have to worry about the next date people being able to show up at is 2 months after that. It also works in the case that someone has to take a leave of absence and the group wants to break from the current project to wait for them. A one-shot or short adventure can fit perfectly into these gaps.
One-shots are also great for conventions and the like when you are playing with people for only a given time slot and likely never seeing them again.
To give breaks
Sometimes your group is doing a long campaign and the DM just gets burned out for any of many reasons. Sometimes it is even the group that gets burned out as well. Sometimes you just need a short change of tone/pace/system to freshen everything up. One shots deliver this in spades.
A couple examples from my table. Maybe you are in a grimdark 3-year-long campaign and people decide they need a break from it. Maybe the DM gets slammed at work for a month and they need a change so they can get through it but they still want to play. We switched DMs and ran a short 5e one shot in one case and ran a short adventure in another lighter system in the other. In both cases it really helped to have something short and different to switch to without the commitment of a longer campaign. Afterwards, we want back to the long campaign with a fresh take.
Disadvantages of a short or one-shot campaign
It really limits the material and how much you can do
You are limited in the amount of material you can cover in the adventure. Obviously, a short campaign is going to have less stuff in it than a long campaign. But to make a short campaign work it generally has to be very focused such that you can end it in whatever time restriction you set. This often means having a smaller world and a more focused plot with less side quests. The plot may also have significantly less build-up and nuance to it compared with a story that plays out over many sessions.
In my own one-shots I've definitely had issues getting things completed in the alloted time even after thinking that I had made a very focused story. Often I have to railroad the party hard to get them to finish on time and/or cut material. However, this is more an inconvenience that a true bad side and sometimes I have to do this in long campaigns as well for various reasons. It is more pronounced when you are running one shots though for sure, especially if you have a party that enjoys RP/messing around/exploring a lot.
Character development takes a hit
Less character development. Shorter campaign means there is less time to develop party dynamics and characters. Generally, making a character and party takes time. In a long campaign, the players have multiple sessions to feel out their character and discover who they are and what they are like and how they interact with the rest of the party. You don't get as much of that in a one-shot (especially with newer players or players new to a system).
Short testing time
I say that testing ideas is an advantage of one shots, and it is. But, there is an important limitation to it to acknowledge: you only are testing things in a small limited window and that might not generalize into a full campaign context. For example, your UA/homebrew character might work great in your one shot at level 5, but there might be something broken/confusing/unfun that happens at level 11 that completely changes the perspective. One shots give you a taste which is very useful, but it is not replacement for extensive playtesting.