The Sun generally sets in the west; however, the exact position of the sunset shifts slightly throughout the year due to the tilt of the Earth's axis. The Sun sets due west only on the two equinoxes (around March 20 and September 22). On other days, it sets either slightly north or south of west, changing gradually through the seasons. For example, in the Northern Hemisphere, at the summer solstice, the Sun sets as far northwest as it will all year, and at the winter solstice, it sets as far southwest as it will.
This variation depends on the observer's latitude and the time of year. Near the equator, the variation is smaller, while at higher latitudes, the sunset position can move significantly along the horizon. Close to the poles, during summer, the Sun may not set at all, and in winter it may not rise.