It depends on why they are unwilling
The Dungeon Master's Guide (DMG) provides some guidance on this issue (DMG, p. 24, bold added):
A soul can't be returned to life if it doesn't wish to
be. A soul knows the name, alignment, and patron
deity (if any) of the character attempting to revive it and might refuse to return on that basis. For example, if
the honorable knight Sturm Brightblade is slain and a high priestess of Takhisis (god of evil dragons) grabs
his body, Sturm might not wish to be raised from the dead by her. Any attempts she makes to revive him automatically fail. If the evil cleric wants to revive Sturm to interrogate him, she needs to find some way to trick his soul, such as duping a good cleric into raising him and then capturing him once he is alive again.
So if the thing making a soul unwilling is the name, alignment, and/or patron deity of the spellcaster attempting to ressurect them, the safest workaround would be to enlist the aide of a spellcaster the soul would be more well disposed to.
However, some souls may be unwilling for other reasons. Perhaps they are satisfied with their work on earth, and ready to enjoy their eternal rest. Perhaps the afterlife has offered them something they cannot attain on earth and has become a higher priority for them. Or perhaps they were uncomfortable on earth, troubled by age and infirmity, and are glad to be rid of it.
In these situations, you may have a harder time. In the last case, you could attempt to cast a different spell, such as Reincarnate, which would give them a younger healthy form. In other cases, you may need to somehow convince them that the cause for which you are attempting to resurrect them is worthy, or that your need is great (and is sufficiently in line with theirs).
This may be difficult, as no resurrection spell gives you the ability to speak to a soul and attempt to coax it back to life. Depending on your DM's flexibility, you may be able to use the spell Contact Other Plane for this purpose (PHB, p. 226-227, bold added):
Contact Other Plane You mentally contact a demigod, the spirit of a long-dead sage, or some other mysterious entity from another plane.
This tells us that the spell can conceivably contact the spirits of the dead. The spell does not specifically say that you can choose who you are contacting in this way, but it also does not forbid it. Your DM will have to decide.
Furthermore, the spell Contact Other Plane does not explicitly permit you to have a conversation with the entity you choose to contact. But you can ask it questions: and these questions may be worded in such a way as to impart or gain relevant information, if you wish (E.G. First question "Would you be willing to come back if you knew that the fate of the world was at stake?" 2nd Question "Did you know that the reason we are trying to resurrect you is that the fate of the world is at stake and you're the only one who could save it?").
Ultimately, the way to make a soul willing to return is the same as the way to make anyone do anything: find out why they don't want to and try and remove it, or find out what they do want and see if you can offer it. Depending on the soul and its reasons, this may be easier or harder (or possibly impossible) to do.