We plan sprints by at first discussing team availability, which includes time required for trainings, off-time for vacations etc.
Next we discuss the backlog items considering who will probably work on which items.
After that we estimate how many story points we will probably manage, both by gut feeling as well as based on the probable task distribution.
This works quite well for us, we usually complete the sprint goals and only seldomly have to add new tasks into a ongoing sprint. If we don't manage to complete the sprint goals it is mostly caused by unexpected events or technical difficulties.
We are in the SaaS business.