In Avengers: Endgame, the Avengers used Pym Particle for time travel. When present Nebula got caught up, past Nebula took her Pym Particle and gave it to Thanos.
But when all Avengers came back from the past, she also came back. How?
Looks like there are two questions on movies and tv about the same thing. Here's the other one: How did Nebula bring Thanos with her?
I'm going to state from the answer there and add a few points to it.
There is an interview with the Russo Brothers: https://bgr.com/2019/04/30/avengers-endgame-ending-russo-brothers-on-captain-america-iron-man/
where they talk about this:
Q: How did Thanos bring his army to the future?
A: There is a guy called Maw in his army; he was a great wizard. Thanos himself was a brilliant genius as well. Those two easily reverse engineered, and mass-produced Pym Particles.
Thanos is from a race of advanced beings on Titan. He has Ebony Maw, who has genius-level intellect, working for him. Once they have their analysis complete on 2023-Nebula’s Pym Capsule, they would send 2014-Nebula to 2023. She then hacks into the computer preparing it for Thanos' arrival. For the rest of the army, they would create more Pym particles.
Now, remember, this is time-travel. 2014-Nebula took only days to return back to 2023, and even if 2014-Thanos took 3 months to produce the capsules, they will travel forward to that exact point in time in 2023. So from the perspective of viewers in 2023, 2014-Nebula and 2014-Thanos returned within minutes of each other. But in 2014, Thanos and Maw could take all the time they needed to prepare the Pym Capsules for the entire army.
2023 Nebula (i.e. 2018 Infinity War + 5 years) did not come back with the other Avengers. She was prisoner on Thanos' ship.
The person who came back with the other Avengers was 2014 Nebula, who was loyal to Thanos. She then became a "sleeper agent". Remember she stole 2023-Nebula's decorative panels, which were a different color, to disguise herself.
2023 Nebula and 2014 Gamora were on board Thanos's ship, and disembarked the ship in 2023.
How did Thanos get spare Pym particles, since 2023 Nebula only had enough for one jump back? 2014 Nebula didn't immediately jump back. 2014 Nebula took 2023 Nebula's vial of Pym particles and presented it to Thanos. Thanos, with Ebony Maw, then reverse-engineered the particles, so he had enough to shrink and jump his huge ship. (and didn't need to do this in any hurry; he had 4 years). This from the horse's mouth.
There is a guy called Maw in his army; he was a great wizard. Thanos himself was a brilliant genius as well. Those two easily reverse engineered, and mass-produced Pym Particles.
The Benetar was sent backward in time with War Machine, Nebula, Hawkeye and Black Widow. Rocket even makes a point of asking if they are going to bring it back.
Presumably, one set of Pym particles to shrink it back down again for return was sent along with it. This is probably the source of the extra Pym particles given to Thanos by past-Nebula. We never see the Benetar in the future again until the very end, so it's plausible they went and got it after the end of the main events of the film. Alternatively, the Benetar seen in the future could be the one that past-Quill arrived on Morag with, though this adds additional complexity.
The only real issue with this idea is that the Benetar was sent with Hawkeye and Black Widow on their mission, so it's not clear why Nebula would have the extra Pym particles, nor why the other team wouldn't return the Benetar with them when they were done. Perhaps the plan was to return the Benetar and its pod separately, and so each team had an extra vial of Pym particles to shrink their component.
As for why no one noticed that Nebula and War Machine did not have their pod:
They went quickly into preparation for their unsnapping, and were distracted and distraught by the death of Black Widow.
It isn't a perfect theory but I think it's what they intended us to get from the scenes involved.
So remember how natasha died? Her particle was never used so I'm sure thanos used that extra particle to come back after nebula opened the portal.