Why do so many anime (e.g. Code Geass, Steins; Gate, Ano Hana) have cicadas in the background?
In Japan, cicadas are symbolic of summer, and possibly symbolize reincarnation as well, based on summer being the time when the cicada comes out to sing.
As per their role in anime, according to Wikipedia,
The songs of the cicada are often used in Japanese film and television to indicate the scene is taking place in the summer.
I do not remember when exactly they appeared in Steins;Gate (nor the other anime), but I would assume that this is simply a reference to a summertime setting.
I grew up in an area that was close to sea level (a bit further south than Japan) and in the Spring and Summer I recall hearing cicadas just about every time I went outside. I suspect the effect in anime is to improve immersion or accurately reflect the reality of the situation that the anime is trying to portray.