Lets take n=10,
now divide the 10 balls into 2 sets of 3 balls and 1 set of remaining one ball.
Now say the odd ball is heavier than others (note this can be manipulated in future while weighing the balls whether the ood one is heavier or lighter)
Now select one set of 3 balls and place them in left side of the balance.
And then place the other sets of 3 balls on the right side
Following cases arise;
Case 1: both sides are equal when we place both the sets of 3 balls.
This means the odd one is the set with 1 ball. no need to carry out the third attempt!
Case 2: Left > Right each time we place the two sets of 3 balls.
This means the Odd ball is in the left side set. Now in the third attempt place any two balls of three on the sides of the balance with one ball each. Now if in this attempt whichever side is greater is odd one and if both are equal, then the third ball is Odd one.
Case 3: If we get Left is lesser than right in first attempt and both sides are equal in second attempt then, the set of three balls on the right side in first attempt contains the odd one. Then in the third attempt place any two balls of these three on the sides of the balance with one ball each. Now if in this attempt whichever side is greater is odd one and if both are equal, then the third ball is Odd one. And if first attempt makes equal and second attempt unequal then second attempt right side set has odd one then follow similar procedure!
Now If you have problem with my n=10. we can follow similar procedure with different number of balls in each set!