To get really technical, the balls are for mixing, but you shouldn't shake the bottle because it forces air into it and can get "bubbly" looking when you put it on your nails. I have always been told that you should roll it between your palms with the bottle facing down. Hope that helps!
Yup, those little balls are the mixers, and it is indeed very important to roll the nailpolish like katapilla stated - i have seen the crazy damage these mixers can do to a nailpolish bottle when it is shook instead of rolled.