how to kill ancient dragons
The Start
First of all, don't feel bad. That Ancient Dragon is level 50. Dragons are among the few random creature encounters that do not level with you, and an Ancient Dragon has over 3,000 health, does 300 melee bite damage and their dragon breath does 100 damage per second. They simply are what they are and my solution with Ancient Dragons when I didn't have the proper gear at lower levels was simply to runaway.
In all seriousness, if you are trying to reload the same game over and over to see if you can beat it, and you don't have the proper gear you should give up because it's not going to happen. I wasted over an hour trying to do it that way before I finally ran away.
For the future, if you want to prepare for the possibility of encountering an Ancient Dragon with a big level disparity between the two of you, keep the following in mind:
GEAR
You need to get a set of gear that will give you 85% frost resistance and a set of gear that will give you 85% fire resistance. This is achievable with just a ring and a necklace if they enchantments are strong enough, but you can also combine weaker enchantments and use the shield and boot slots as well.
You should also keep a set of Fortify One-Handed skill apparel. The apparel slots that will hold them overlap with the those that will hold Resist Fire/Frost damage enchantments (boots, rings and necklaces) but you can hotswap the Resist Fire/Frost ones with the Fortify One-Handed ones when the Dragon lands. If you can lower a Dragon's health enough, it wont take flight again.
Use frost enchanted weapons against fire breathing Dragons and fire enchanted weapons against frost breathing Dragons. They are 25% more vulnerable to the opposite kind of damage that they inflict.
Another good choice for an enchantment for your weapon is Paralysis. Once that Ancient Dragon lands you do not really want it ever to take flight again where it can continue to abuse you with ranged attacks. A weapon with a Paralysis enchantment will ensure this doesn't happen and make the melee exchange fairly one sided. Unfortunately Paralysis enchanted weapons are not that common so this may not be an option.
Don't be afraid to use up all your Restore Health and Restore Stamina potions. At your current level Ancient Dragon encounters aren't going to be frequent and are going to be very tough.
FIGHTING STRATEGY
Fight smarter not harder. Use shield bash to interrupt their melee attack on you and follow up with your melee attack. More importantly, large non-biped mobs are particularly vulnerable to a melee fighting style that uses constant circular motion towards their side and back simultaneously while attacking. They cannot attack you if you are towards their side and away from their head and if you can get to their rear you can initiate power attacks without worrying about taking damage from a counterattack from them.
Huge forum thread about this matter, props too Dagmar for the descriptive answer.
Although pretty much useless for anything else, the wabberjack combined with dragon-rend (to keep the thing on the ground) is pretty effective. Dragons are the only thing that the wabberjack will actually hurt. I carry mine all the time and yes - it takes down legendary dragons
Try to sneak up to an Ancient Dragon if it is at a Word Wall and call Odahviing. When he arrives, attack the ancient with Firebolt, this will surprise it. Use Dragonrend to make it land so Odahviing can attack properly.
If you have finished the main quest, use the Dragonbane to attack. If you don't have it, just use a decent sword (or your favourite weapon) to attack. And you will need LOTS of health potions and stamina potions, especially if the Ancient Dragon has frost breath.