For adding custom items to mobs, armor stands and villager trades use the the give command generator and select the correct version and summon item. Then copy paste the nbt portion (the part with brackets) into the tag column.
It can be tricky to select the right brackets, the bracket is usually from tag/component colon and cuts off the last two curly brackets.
1.20.5+
It's important the select the correct version, as the tags are different. For 1.20.5+ tags are now components.
/give @a diamond_hoe[enchantments={levels:{mending:1}}] 1
/summon item ~ ~1 ~ {Item:{id:diamond_hoe,count:1,components:{enchantments:{levels:{mending:1}}}}}
1.20.4 and below
/give @a diamond_hoe{Enchantments:[{lvl:1,id:mending}]} 1
/summon item ~ ~1 ~ {Item:{id:diamond_hoe,Count:1,tag:{Enchantments:[{lvl:1,id:mending}]}}}