Why are deserts mostly located on the western side of continents?
Some of the driest deserts on Earth occur in the western side of continents and they are called Coastal Deserts. Examples of such deserts are the Atacama desert (Chile, the driest desert on Earth), the Baja California desert (USA/Mexico), the Namibia desert (southwestern Africa), and the Atlantic coastal desert of Morocco/western Sahara/Mauritania. In mid-latitudes, the western side of continents is most frequently occupied by deserts, while the eastern side tends to be covered by forests (e.g., Amazon rainforest).

. Distribution of non-polar arid regions. Source: USGS. 

Coastal deserts occur east of the strongest coastal upwelling regions in the world. The upwelling is associated with eastern boundary currents flowing equatorward (due to Coriolis): the Canary Current (off Northwest Africa), the Benguela Current (off Southwest Africa), the Humboldt Current (off Chile and Peru), and the California Current (western North America). The prevailing winds in these regions are the trade winds that flow parallel to the coast and generate upwelling dynamics: surface Ekman balance is setup (in deep enough waters) with water transport being to the right (left) of the wind in the northern (southern) hemisphere; this causes a deficit along the coast that needs a compensating flow in the deeper part of the water column bringing cold, nutrient rich waters (some of the most productive regions in the world) to the surface.

 Source Commons Wikipedia.

The cold waters near the ocean surface results in a cool, stable coastal atmosphere. In this region, evaporation from the ocean is reduced and produces extremely low rainfall over land. Precipitation is limited to morning fog and produces some of the driest ecosystems on Earth. The Atacama desert is the best example of such environment with average rainfalls of 15 mm/year (the driest non-polar region). In some areas, they are trying to take advantage of the little moisture the fog (Camanchaca) brings to establish some agricultural zones. The fog droplets are too small (1-40 micrometers) to form water drops and precipitate, so they use fog-catchers to collect moisture from the fog.

 Source: newatlas.com