If you're using online services to create sprites, let them write the background-positoins for you (like spritecow). Otherwise, you'll have to learn how to do it by hand like we all did back in the day, for each sprite.
I tend to open up my sprite in my image editor. I set the CSS to 0, 0 so I can see the image that appears at that coordinate (I know I'll see something since there's always something at the top left corner). In my image editor I usually use the rectangle selector to draw a box around the icon and check the coordinates of the top left corner. Sometimes I can just set my mouse there directly; it depends on how much transparency in the image.
The I use those coordinates I see in my image editor and write them as negative background position numbers in CSS.
So if an image's top left corner is at 15, 47 (15 px from left, 47 px down from top) the background-position is 15px -47px.