I have my own ideas about dragons, and how to run them in a campaign. I think dragons should be scary. Lots of DM's seem to throw dragons at players as if every color of dragon in the Monster Manual needs to be used. The word 'dragon' is in the title of the game after all. But this has diminished the scare factor of dragons some what. So bring the terror of dragons back into your game. Players should be terrified of a dragon. If you get into a fight with one, it will murder you and your party.
Dragon tactics
As mentioned above, dragons are cunning opponents. They have defeated many opponents already, and would thus require some really good tactics on the part of the players. Almost all dragons can fly, so the first thing it would do, is take to the air. If it is inside a cave or lair, it will leave the lair. This doesn't mean that the dragon is leaving its hoard undefended. Oh no, it is perfectly fine with making circles outside the lair, to wait for the players to come out.
Dragons have no reason to land. Because that puts them in range of sharp objects. Why give up your aerial advantage? A dragon should use its breath weapon from the air whenever able, and while it is recharging, it simply flies off, only to circle back shortly after. A dragon is not going to play fair, and it is not going to leave the players alone (especially if they touched its treasure, or ventured near its lair). It will follow them to what ever town or city they think of hiding in, and burn it to the ground. That is what dragons do. There is no place in the world where you can hide from a dragon. It will keep following you, and turn everything to ashes. Dragons have an extremely good sense of smell, and it will be able to track the players, even if they move to a different continent.
Some DM's may think that if the dragon doesn't land, then its not a very fair fight. Exactly! Your goal should not be to allow the players to defeat the dragon easily. Your goal should be to have the dragon attempt to obliterate the players. To utterly destroy them. If they manage to survive, good for them. And if they still manage to defeat the dragon, then the victory is truly earned.
(The dragon in the 1981 movie Dragonslayer would be considered a 'wyvern' by the D&D definition, due to its two legs. But as a storyteller it is entirely up to you what a dragon in your campaign looks like. In Europe two-legged dragons are perfectly acceptable in various depictions and fairy tales. There is no need to restrict yourself to the narrow definition in the Monster Manual.)
Talking Dragons
Dragons in D&D can often talk, but again this is entirely up to you as a storyteller. Maybe your dragon only uses telepathy to communicate. Or maybe your dragon does not talk at all, and is basically just a big flying angry lizard that spits fire. I personally prefer the latter.
Attacking a city
Laying waste to cities and villages is what dragons love to do. Especially if their enemies consider themselves to be safe in there. Dragons can be extremely vengeful, and will gladly unleash their wrath on settlements, and reduce them to ashes. But of course not all settlements are so easily destroyed. A dragon would prioritize taking out siege weapons that could harm it, or simply stay out of range of such weapons. Aiming a siege weapon takes a while, and dragons are very mobile. So a dragon could simply stay on the move and circle around a city to take out the siege weapons one by one. If a dragon starts taking too much damage, it will not fight to the death. Instead it would retreat to recover, and then return as soon as its able to get its revenge. Dragons are not suicidal, and they are very patient.
The Lair
A dragon's lair is specially constructed to benefit the dragon, and put the treasure out of easy reach of nosy adventurers. The entrance would not be easy to reach. Coastal dragons would obviously place the entrance underwater, or inside a very high cliff, where there are no roads leading up to it. Keep in mind that dragons do not want visitors, and so they will have picked a location that is not easy to reach by unwanted visitors.
Lair terrain hazards
The lair will include various natural obstructions, that do not inconvenience the dragon in any way. Such as: Lava flows, acid and water. Difficult terrain in the form of rock debris, and cadavers, which slows the players down (but not the dragon). Darkness, because that is not going to bother a dragon either. And height differences, such as high ledges that the dragon can use while safely out of reach of the players, and deadly crevices and pits. The dragon prefers not to fight in an enclosed location, but if forced to, the lair should be a very dangerous place to fight in to the players.
There will probably be locations inside the lair, that the dragon can leap up to, to gain the advantage of higher ground. Keep in mind that the dragon will always prefer to use its breath weapon from afar, and not get into close combat with the players. It will also attempt to use the terrain against the players, and maybe collapse part of the lair on top of them. This is not a problem for a dragon, because with its massive claws it can easily dig out the lair later.
Multiple exits in lairs
The lair will also have plenty of space for the dragon to move around, and will most likely also have one or more secret exits, so that the players can't simply collapse the entrance and trap the dragon. There may be a vertical shaft that the dragon can fly up to, to crawl out of the lair in case of an emergency.
Lair protections
The lair will be protected with traps, minions, spells, and hazardous terrain. Illusion spells would hide parts of the lair from sight and keep visitors at bay. Magical symbols and traps could be all over the place. The lair may also have environmental effects, depending on the dragon type (you can find all about this in the Monster Manual), such as disease, decay and fear effects. Imagine a dark maze littered with the remains of everything a dragon eats. It would probably smell like a an abattoir mixed with the smell of sulfur. Not a nice place to be. Wandering into the lair of a dragon would probably send most visitors running for the hills long before they even catch sight of the dragon that lives there.
The Hoard
A dragon's treasure will be well guarded, and placed safely out of reach of adventurers. Its probably up somewhere high, so that anyone who can't fly will have a really difficult job getting to it. Or it may be hidden underwater, because why not? The treasure may even be protected with spells, because plenty of dragons are spell casters. And don't forget that there are probably traps near the treasure, and all over the lair.
Minions
While dragons usually are solitary creatures, its lair may contain young, which are also formidable foes. A group of these is already a big threat to the players, and if they kill any of the young, the adult is not going to rest until the players are destroyed.
A lair can also contain various scavengers and vermin, that are attracted to the piles of carcasses that litter the dragon's lair. The creatures attracted to the left overs are obviously lower on the food chain, and can sometimes safely live inside the lair. But they can still be formidable opponents in their own right, and sometimes a dragon deliberately keeps them around to protect the lair.