the game picks the three villagers you have highest friendship with and one invites you over to their house. depending on your friendship level you will get a random piece per section of friendship levels. i believe if you aren't really good friends with any, but HAVE introduced yourself to 3 you will get the hat. if you're good friends (they wave/bow to you when called with megaphone) with 3, you can get either the cake or the shades. and then if you're maxed friendship you get either table, sign or candles.
and something that really stinks is that you can't TT backwards and have another bday party. when you go back there won't be a villager waiting by your door to invite you over for a party. the villagers you talk to will still say happy birthday, but no second present :< (yes.. i did try to get more than one piece... >.>)
if you go
here it tells you how to obtain each piece, in case you were wondering :>
i'm planning on making a second character and setting their birthday to a few days from now and introducing myself to the villagers just for the hat :3 i really like it!
i hope this was helpful and not too ramble-y.. i find it difficult to be concise sometimes >.<