8-ball is the most popular variation of pool, since it is easy to learn and doesn't rely on the numerical order of the balls that you sink like 9-ball does. Since 8-ball uses all 15 balls, you do not need a special rack or extra attention to detail in order to get them to rack properly. This does not mean that there aren't rules to follow in order to correctly rack the balls for a game, though. The rules for racking pool balls for a game of 8-ball are relatively simple, and you should be able to correctly rack the balls with ease after only a few minutes of practice. Here is what you need to do in order to become an expert at the rack.
Place the rack on the pool table near the foot spot (marked with a round decal on the table) and place all 15 pool balls in it. The order doesn't matter at this point, as you'll be rearranging some of the balls and the others should be randomised anyway.
Swap whichever ball is located in the front of the rack (also known as the apex position) with the 1 ball. While this is not necessarily mandatory, having the 1 ball in the apex position is a matter of tradition.
Swap the ball that is located in the centre of the rack (the centre ball in the row that has 3 balls in it) with the 8 ball. The positioning of the 8 ball in the centre of the rack helps to prevent it from being knocked into a pocket on the break (since sinking the 8 ball before the last ball of your colour results in you losing the game.)
Though the numbers on the balls is not important, the two rear corners of the rack must contain 1 solid ball and 1 striped ball. Unofficial rules may allow for entire sides of solids and stripes, but according to official rules these positions that have been mentioned so far are the only ones that must have specific balls or types of balls in them.
Roll the rack back and forth 2-3 times, stopping it each time to help ensure that the balls are clustered together tightly. After a final forward motion, slowly move the rack back so that the ball in the apex position (most likely the 1 ball) is centred over the foot spot. You may then carefully remove the rack, repeating this process if any of the balls attempt to roll out of the cluster.
For added flair, try removing the 8 ball after all of the balls are in position and placing it between the balls of the fourth and fifth rows so that it's sitting right above its former position. When you start to tighten the cluster of balls in the rack, the 8 ball will fall back into its position (it may take a little bit of practice to get this one to work.)