No correlation between time remaining and rush failure percentage
The in-game help mentions that the probability of a rush failure decays over time. Attempting a rush, whether it succeeds or fails, will increase the probability of a rush failure in that room, but this is a one time increase and it starts to decay again after that. There also seems to be a lower limit on rush failure. likely based on Luck and the appropriate SPECIAL stat for the room. The lowest I've seen is 21% failure chance on a room that I haven't rushed in days. James reported seeing as low as 16% with a maxed out, very lucky water treatment plant.
In my experience, the failure decay rate is so small that you probably would not notice it over a few minutes (the normal task completion time for a well populated room), but it becomes noticeable over a few hours. After spiking the failure chance in a room to around 50% right before bed, I woke up the next morning with the failure chance back down to upper 20s/lower 30s. This seems to indicate that it is based on elapsed time rather than decaying after a room is harvested.
When you couple this with the fact that the timer is reset to max after a rush is attempted, rushing a room with a few seconds left is not as resource effective as harvesting the resources, then attempting the rush when the timer is full. In that case, you save a lot of time if you succeed and don't lose as much time if you fail.
tl;dr
It seems to be a percentage calculated when you click the rush button, regardless of how much time is left until the room produces resources. Rush failure percentage chances slowly decrease over time, but this is noticeable over tens of minutes and hours, rather than seconds. If you want to maximize the amount of time your rush saves, rush right after you collect, when the room timer has a lot of time left.
RNG hates you.
It's not that there's 100% chance of failing (unless it's bugged), you're just really unlucky.
Just keep trying you'll eventually complete them. You can try putting more skilled dwellers, such as more S in power rooms, as well as luckier dwellers. Both reduce the chance of failing a rush.
Note that the rush chance of success decreases quite dramatically after a rush (succeed or fail) so doing it many times in a row will make it harder to do a successful rush.
See this answer for more factors influencing rush failure rates: https://gaming.stackexchange.com/a/224005/106901
Best Answer
There are mainly 3 factors which seems to take effect on the rush accident rate:
Hopefully this will help you.