The rainshadow effect happens when an airmass that is over the ocean picks up a large ammount of moisture and carries it onto land. On land when the airmass comes across mountains, the airmass is forced to rise in altitude. When these airmasses reach a certain altitude the water vapor condenses and it rains on the windward side of the mountain. All of this rain creates forests or in some cases rainforests. Once the airmass gets to the other side of the mountain, there is little to no moisture in it. So there is no rain on the leeward side of the mountain. And on top of that, the airmass absorbs the moisture that was already there, this creates a desert.