1. Create a pit stop preset and make sure it is active; for changes to work, they have to be green - white means they won't be done.
2. If you have multiple active presets, you can move them around and set priority.
3. While racing, you have to call for a pit stop with the appropriate key/button.
4. At the top, you'll see your pitstop preset name. If you have multiple active presets, you can toggle them with the left/right keys or buttons mapped for it.
5. You'll see your presets selections in green, but you can also make changes on the fly. For instance, I have a preset just to change tires (front and rear tires are selected as green), but I didn't select fuel despite having put a value of 10 litres just in case. What this means is that in normal circumstances, I would only change the tires, but at least I have the option to add 10 litres. If I want to do that, I just have to navigate over the fuel button and make it green by selecting it. Also, you can add more fuel with the arrow keys/buttons.
6. Finally, and perhaps most important (we've all been there), don't forget to confirm your selection by navigating to "Confirm Pit Stop Actions" and selecting it. Note that you can only confirm your pit stop while you're in the pit lane.
The pit stop system in R3E is really convoluted and overly complicated for no reason, but I think this explains it best. Good luck!