You can train 5 times each level. What you train is not important. You can train 5 times pickpocket, or you can train 1 pickpocket, 1 speech and 3 in two-handed, for example. No matter what you train, you can train it 5 times each level. In order to train more, you have to level up. That will reset the 5/5 counter back to 0/5. The counter is global, so don't think that you can train 5 times speech AND 5 times pickpocket. No matter what you train, if you train it, it counts for all trainers. If you reached 5/5, you have to level up in order to train more.
Let's just say you stand next to a trainer, and have just bought the third of the five training sessions, and suddenly a message appears that you have gained a level and can level up now. Don't do it! You have only trained 3 out of 5 times, and if you level up now without training the last 2 sessions, the counter will reset, and you lose the opportunity to train the last two sessions. After you paid for the last 2 sessions, and you are now 5/5, level up. Now you can train 5 times more for that level.
You will notice that training will get very expensive the higher your skill is. If you you have no problem stealing a lot of cash from someone's pocket ingame, you can steal all the cash back. You can train 1 session, quicksave, and steal your cash back. Dozens of videos on YouTube show that, but it's time consuming and slow. And the more cash you have to steal back, the harder it gets to not get detected. If you are up to over 5000g, it's nearly impossible to get your money back without killing the NPC, and we don't want to kill him, because we need him for training.
I don't know if anyone has found that out yet, but I found a fast and convenient way to get all your cash back without getting caught and without quicksaving and reloading a dozen times. All you need is the perk in the pickpocketing tree that allows you to put poison in the NPC's pockets. Train all 5 sessions, quicksave (never hurts), sneak and put paralysing poison in the trainers pocket. If it's successful, the trainer will go down like a rock. Just stay sneaking and try to pickpocket him. While he is paralysed, it won't work, but you want to pickpocket him at the exact moment when he comes to. You can then clean out his entire pocket, and he will just stand back up and is happy to see you. Worked every single time for me. Just spend the perks in the pickpocketing tree, brew yourself some paralyzing poison, and you will save a LOT of money.
Hope that helped.