Both are good questions but neither have easy answers.
Rain can wash fallout out of the air if the detonation is small enough where much of the cloud stays at or below the level of precipitation. This is bad if you’re in the area it’s raining in because it can lead to more concentrated fallout than may have occurred otherwise. On the other hand it’s good for those further downwind because a portion of the fallout they would have received gets rained out. Before you get too excited, most modern nukes blast their debris clouds above most rain storms. So the effect on fallout is negligible with modern warheads.
As for how long the fallout is “dangerous”? That depends on how much/how bad the fallout is initially, and what you consider “dangerous”. If by dangerous, you mean that it will kill you through acute radiation syndrome, you’re probably looking at 24-48 hours. After that, it becomes much harder to accumulate a lethal dose fast enough. The problem is that most of what “we” know about radiation injury is based on acute exposure to radiation, that is large doses that occur in a few seconds to minutes. When you spread the doses out over longer periods, it becomes more difficult to predict what will happen. Unless you have a way to measure the ambient radiation levels, there’s no way to really know. Even if you can measure them, once you get out past the first 48 hours to two-weeks, it becomes a statistics problem. For example, We don’t know exactly how much radiation it takes to cause cancer. What we know is if you expose a large number of people to X amount of radiation, statistically Y number more cancers should show up. But there’s no way to know exactly what an individual person’s threshold is. You and I could be exposed to the same amount of radiation and one, both, or neither of us might develop cancer.
The bottom line is that if you don’t have any means of receiving information like a radio or measuring equipment. Try to hunker down for at least the first 48 hours. That allows the radiation levels to drop by 99%. 2 weeks is more ideal if you can store that much food and water. After that, most areas should be safe to leave shelter long enough to do some work outside, evacuate, etc. The hardest hit areas, like those in and around ICBM fields, it could be a month or more before it’s “safe” to spend extended time out of shelter.
Clear as mud, right?