By playing and trying to get better points than your competitors.
It always depends on the game. Sometimes you get 1 star and sometimes 3 and you are at the top.
I hope this helps you further!
I have played one level and won over 100 times and still only have 2 stars. I once finished it with 18 moves left and only got 1 star. that's silly to play a level that well and not get 3 stars. have many levels I have won over 50 times that still have only one star. won't be playing so many levels now thst sugar drops are capped at 5 ! don't get excited by the stars as I can't find rhyme or reason how they are awarded