Notice the patterns on each card. The first card probably consists of all even numbers or all odd numbers. This narrows down the possiblities to 15 or 16, depending on whether your birthday is on an even or odd day (for example, if you say your birthday is not on the card when she is holding up the multiples of 2, then she'll know it is an odd number). Then, she'll keep narrowing it down from 15 to 7, from 7 to 2 and finally from 2 to 1, taking a total of 4 cards. Notice the patterns on each card. Just think analytically.
Alternative method: Let's say she has X, Y, Z, A cards. If you say 'Yes' on cards X and Y for example, there is one overlapping number that is not on cards Z and A. If you say 'Yes' on X, Y, and A, therefore the number is not on card Z.
The short answer is that the numbers are not written on the cards randomly, but in a very specific pattern, so that someone who knows the trick can immediately tell you when your birthday is from the cards that have your birthday written on them. But you probably already guessed that much.
The long answer requires you to know a bit about binary numbers. Binary numbers use just two digits, 0 and 1. Like computers. In decimal numbers you write the number 425, and you know from the position of the numbers that it is 4 hundred plus 2 times 10 plus 5. Each position further to the left is ten times greater.
In binary numbers it's the same way, except you start with 1, and each position further to the left is just two times greater. So the number 11011 is 1 plus 1 times two plus 0 times four plus 1 time 8 plus 1 times 16.
So the numbers from 1 through 31 can be represented with five binary digits, because 31 equals 1 + 2 + 4 + 8 + 16, or 11111.
So you take your five pieces of paper, and you write on the first one all of the numbers from 1 through 31 that require ----1 in binary. (This happens to be all odd numbers from 1 through 31.) On the second paper you write all of the numbers that require ---1- in binary (2, 3, 6, 7, 10, and so on). Continue like that for all five pieces of paper.
If you want to be tricky, mix up the numbers on each piece of paper so that people can't spot a pattern. (This might make them look random, even though they're not.)
Your birthday, the 10th, is 2 plus 8, or 01010 in binary, so it would appear on the second and the fourth piece of paper, but not on any of the other three. All you teacher now has to do is convert 01010 to decimal: 2 + 8 = 10.
here you go