(Edit, 24 Oct 2017: included Dropbox as a good example of what to do)
When creating language selectors, make sure the language labels are written in that language, not the language the page is currently on if it differs. For example, on an English-language web page, German should be written as Deutsch, not German. This makes it easier for people to find their own language. Someone browsing a website that defaults to Japanese and wants to find German may not know that ドイツ語 means Deutsch. But if the link says Deutsch they will be able to recognise it. Wikipedia uses this strategy when labelling languages in the sidebar – if you want to find Czech, you just need to find Čeština. Also, make sure the languages are alphabetised by their own name, not by their names in English or another language.
Example of what to do:
Dropbox writes language labels using their own names, so German is Deutsch and Indonesian is Bahasa Indonesia. (They also get a few other things right too – they label all dialects for English, Chinese and Spanish and include indicators for Norwegian and Portuguese as well. Flags are not used to represent languages. The languages are alphabetised according to their own names, not their English names. The Ukrainian translation is a beta and is marked as such.)
Example of what not to do:
This is a screenshot from SquirrelMail, a popular webmail web app that comes installed with many hosting packages. The language chooser has all the languages listed in English (except for Malay and Indonesian, for some reason), regardless of whether the UI language is set to English or not. If I speak Arabic and want to find it in a list, I don’t want to search for the English name.
(language drop-down or unordered list)