Samuel L. Jackson's Nick Fury was one of many characters who met an uncertain fate at the end of Avengers: Infinity War. However, the actor says he already knows how his character can return to the MCU. Jackson doesn't have any specific inside information about what the plan is for Avengers 4. Instead, he says he was able to figure out what the solution will be that will bring him, and likely many other characters, back in the next Avengers film. The answer is apparently inside Captain Marvel. According to Jackson...
I had no idea, it came out of the blue. Who's really dead, and who's really in the flaky wind of Marvel dust, I don't know, but I do know there's a solution that they didn't even have to tell me, just because I know who Captain Marvel is and what all that means.
While Samuel L. Jackson isn't too specific, it sounds like there's something within the character of Captain Marvel, such as what her specific powers and abilities will be, that could relate directly to how she will be able to help in Avengers 4. Alternatively, the plot could relate more directly to the story being told in these two Avengers movies than we thought. We know the movie will see Captain Marvel battle the Kree, and Thanos certainly had dealings with them in Guardians of the Galaxy. Either way, there's something in that movie that either gives an obvious solution or at least lays out the puzzle pieces for putting a potential solution together. Since Samuel L. Jackson will co-star in the film alongside Brie Larson as a younger Nick Fury, he's privy to whatever the script reveals.
The sole post-credits scene of Avengers: Infinity War shows Nick Fury using his last few moments of life before being falling victim to the Infinity Gauntlet to send a message to Captain Marvel. At the time, it seemed like it was Fury throwing a hail mary. There was little else he could do. However, based on what Samuel L. Jackson tells Vulture, it's possible there was more to the move. When Fury watched Maria Hill vanish, did he have some sort of understanding about what he was seeing, and realize that Carol Danvers had specific knowledge or abilities that could help?
Whether the solution is specifically spelled out in Captain Marvel or just something Jackson was able to put together himself, if he could do it, then it's likely others will be able to as well when Captain Marvel hits theaters early next year. Captain Marvel arrives in March of 2019. If the answer isn't perfectly obvious by then, we'll see the actual solution when Avengers 4 hits in May.