The Question and Answer section for The Hobbit is a great resource to ask questions, find answers, and discuss the novel.
Bilbo and the dwarves agree to keep their mission a secret from the Elvenking because they are afraid he will only help them in order to get a large portion of the treasure.
If Gollum wins the contest, he gets Bilbo for dinner. If Bilbo wins the riddle contest, Gollum will help him make his way out of the cave.
From the text:
"You! You!" cried Thorin, turning upon him and grasping him with both hands. "You miserable hobbit! You undersized-burglar!" he shouted at a loss for words, and he shook poor Bilbo like a rabbit.
"By the beard of Durin! I wish I had...