its pretty straight forward (one you look at the code and math behind it)
renaming an item will make repairs stay at a static number. non-named items will increase the needed xp each time you repair.
so if u plan on keeping something for a long time rename it, it will be worth it.
every time you combine an item it becomes more expensive to combine again
so if i made a smite 5 out of two smite 4 swords (there first enchantment was smite 4, and they had never been anviled) it would be a lot cheaper then combining four smite 3's into two smite 4's then into one smite 5 (which is how i got mine because there is a priest in town that makes smite 3)
the enchantment will upgrade when its combined with another of the same type.
sharpness 1 + sharpness 1 = sharpness 2
sharpness 2 + sharpness 2 = sharpness 3
BUT
sharpness 2 + sharpness 1 = sharpness 2
and there are certain types that will cancel each other out, or something like that
a sword can have either smite, sharpness, OR bane
armor can have protection, blast protection, projectile protection, OR fire protection.
material does not seem to matter with the anvil so iron isnt more expensive than diamond when combining enchantments.
40xp is the limit in survival mode (creative you can go much higher) once it gets higher you cannot combine anything else.