Whether a compost bin should be placed in the shade or sun is directly related to your climate and specific conditions, including the type of waste you're composting.
Having the bin in direct sunlight helps increase the internal temperature and accelerates the decomposition process. It also assists in drying out excess moisture and reduces the chances of the mix becoming anaerobic.
However, be careful with placing the bin in direct sunlight all day as this can cause the mix to dry out, slowing down the decomposition process. It's a bit of a fine line, and you want the mix to be moist and warm/hot.
I would advise selecting an area where the bin gets several hours of sunlight per day, but not enough that it requires you to re-moisten the contents regularly. - MitchellMc
I agree with Mitchell's advice. The location depends where you live to a large degree.
I'd recommend 4-6 hours of direct sun a day for most of the year but if you can position the bin where it receives at least partial shade for most of the day over summer (ie under a deciduous tree, for example), all the better.
If the temperature inside the bin gets too hot, it will disrupt the normal composting process and cook the contents, rather than encouraging natural decomposition. - Noelle