Why did the Elves leave Middle Earth?

Why did the Elves leave middle earth why couldnt they just stay with men? Men could still be dominat race even if Elves were still around. Also why did Frodo,Gandolf and Bilbo leave?
13 answers 13