Nearly every weapon and armor can be upgraded by fitting it with characteristic elements, e.g. greaves for the armor, or the blade for swords. You can also use runes, which are often available for both. Legendary items usually have, at least, one upgrade already. Elements can be both assembled as much as they can be disassembled. This means that if you find an interesting weapon which is worse than your current one, but may have an interesting rune/upgrade - remove it before you sell the weapon.
It is very important not to confuse the upgrades. Light pauldrons cannot be used in heavy armors and upgrades for the staff cannot be used in a two-handed axe. Always make sure that you are using the correct schematic.