So I finally killed the Ender Dragon! As I was climbing the portal back to the world, I noticed that on top of the column there was an egg. So I attacked, mined, clicked and nothing happened, it just teleported away. What does the egg do and how do I get it?
The dragon egg does absolutely nothing (well, apart from eluding most attempts to pick it up). Put it on your mantelpiece to show them online.
From Minecraft Wiki
To obtain the dragon egg, the player may push it with a piston, detonate it with TNT, or place a torch or slab under the block the egg rests on and then destroy that block so the egg falls onto it. It is possible for the player to hit one while it is still moving to the point it breaks, however this is difficult. Another solution, is that you can start breaking a coinciding block and then scroll over to the egg while holding the break button, in this case you will start breaking the egg instead of it teleporting on contact.
Since other answers tell you how to get the egg, I'll tell you some of my ideas of what it could be used for:
A Sign of Wealth
If you play on factions, or any other competitive server, displaying a dragon egg prominently has its uses. First, a invading group would say "Hey, that guy has enough armor/skill to defeat the Enderdragon!" That might cause them to stay weary of you.
While this is sorta ridiculous, it could be used as a currency. Since it is impossible to obtain after someone already has, it is impossible to counterfeit (unlike gold or diamonds, which can easily be mined). However, the problem with this is you have only one.
A Sign of Rulership
If a town has a king, this is a full-proof way to known who is the king. While this may not be needed if the king never changes, it might be useful if he does commonly. Since there is only one dragon egg obtainable, one player can use it as proof he is, in fact, king. The upside of this is that it's impossible to counterfeit.
A Random Number Generator
Even though it is much easier to do this with pigs, for example, the dragon egg, when clicked, teleports randomly to a block in the nearby vicinity. While it is not practical, it could be used in a place like a casino, to add a bit of show to betting.
This last one is pretty stupid. It is technically possible to build a device that is based off falling sand breaking cacti which break signs, but with a dragon egg instead of sand. The reason this works is because a dragon egg falls just like sand.
Somehow nobody mentioned that dragon egg is also used in practice.
Due to a long standing bug it's possible to break bedrock with dragon egg falling in a lazy chunk.