How can I work my way back into a good relationship from being denounced?
If you want the best possible relationship:
- Settle nowhere close to them. (Make sure your borders don't reach them either)
- Constantly give them gifts.
- Make sure their army is bigger than yours.
- Let them do anything they want, allowing you to only have the "breadcrumbs"; essentially, anything that's left over (which would probably anger other states too anyway).
- Make sure you don't have good relationship with any city-states near them (even if they're near you too).
It is nearly impossible to do that if you're already mid-way through a game. The way that your 'reputation' works with other AIs is that if they can't do anything and you're in their way - They'll start to hate you. Even if you're their military supplier or the 'guy' who gave them (other nations) all the gold you earn etc.
There is no way to make AI players voluntarily want to ally with you, unless you do something that they like (ie. Go to war with someone they're at war with).
The way relationships with other states work is that you have to share a common goal with them in order to get 'on their good side'; be allies/friends.
Other than that - It's nearly impossible to get world peace (everyone allied with each other).
For some problems such as building wonders that they want to build (and already having built them), there's nothing you can do; nothing can be demolished (except for tile upgrades).
Example: I was a warmonger (had heaps of military units), but didn't use them to attack other nations. However, all the other nations except for one hate (and constantly denounce) me as they themselves were warmongers and was at war with another nation for constantly denouncing them.
There was no way I could improve my relationship. I've been accepting all their demands, gifted them everything, agreed to their wants in the world congress and everything for over 400 turns. Every time I improved my reputation with them (they start to like me), it went down again (they hated me more).
EDIT: The only way I could make them start 'liking' me was to destroy my huge army, which would leave me vulnerable to their attacks as they had a descent army themselves (around 10 units, compared to my 50+ units)
AI Civilizations tend to hate their nearby neighbours, this is particularly true for "coveting your land".
Generally speaking, if they have similar goals to you, and they are far away, they will end up liking you. Your nearest neighbours will end up hating you no matter what your goals are however.
How badly do you want them to be your friend?
Ultimately one of the most drastic ways of gaining their trust, is to move your empire away from there, relocate elsewhere, and then give up any cities near them. If you are near to them, they are going to hate you. The only way to realistically change this to to move away from them.
If you have BNW then putting diplomats in their territory can help as well.
Possibly the best way to get the allegiance of an AI Civilization is to fund a war effort against it. Don't capture any cities yourself, but help other Civilizations to take them out. Once your AI Civilization is completely eliminated from the game, go and take one of their old cities, and then re-instate them back into the game. This will make them love you, no matter how they felt about you before.
To be honest, if I ever go for world peace, I usually find I need to take out a few nearby neighbours to achieve this. Its easier to wipe out your neighbours and then try to seek peace with everyone else than it is to befriend neighbours in my experience.