Good question! One major problem of long-haul flights is the age of the wx forecasts in your flight preparation papers vs. the quick and unexpected development of especially convective adverse weather.
If the wx is of such magnitude that passing through it is not possible, ATC will offer reroutings to pilots. But in most occasions, the decision rests on the aircrew, as they have to consider other operational aspects as time in their tanks, navigation equipment etc.
If the adverse weather consists of ISOL CB which can easily be circumvented, ATC will most likely not issue big reroutings and let the pilots do the wx avoidance on a tactical / ad hoc level.
If the aircrew is lucky to work at an operator with savvy dispatchers, they will pro-actively send an ACARS message to the crew, so they can prepare for the wx development ahead.
So most of the time, the flight crew has to come up with an idea. And their means of situational awareness are limited. As of now, the only means to really see what is ahead is the wx radar, usually having a range of 120-200NM. So it is common practice to ask aircraft ahead on track about the wx situation.
After gathering all the facts, the classic decision workflow starts. At my company, we use F-O-R-D-E-C, which stands for
...where "D" is the point at which you make your decision. Depending on the time available and the task to be solved, FORDEC may take 10 seconds (fire on board) up to half an hour or more (I guess https://en.wikipedia.org/wiki/Qantas_Flight_32 must have been such a case).
The "C" part (for "control" or "check") is a reminder to revisit your decision at a later point in time and check if it is still valid.
In the future, we will see more and more "connected" flight decks, where pilots can receive long-range wx information as live radar pictures directly into their electronic flight bag. This could have saved the lives of the people onboard AF447:
The yellow circle represents the range of the wx radar (what the pilots of AF447 could see) and the red polygons represent the known wx situation from a satellite picture.