Some important caveats here: FiveThirtyEight.com is far from infallible. It basically consists of a bunch of statisticians who run probabilities based on polls and all kinds of other factors. The media treats their founder Nate Silver as if he's some sort of predictive deity, but he's just a guy who's worked out a system that's got some logic to it.
Also: A 40.8 percent chance of winning would be horrendous if it were the night before the election. But it's not. It's mid-July, and Donald Trump's job at the Republican National Convention last week was to put himself in a stronger position to win the general election All signs are that he did just that, as Silver's site has his chances decidedly on the rise.