As night falls on certain beaches around the world, the waves glow with an eerie blue light: tiny, neon dots that make it look as though stars are washing up on shore.

The surreal scene arises not from magic, but from plankton that have evolved to glow in order to startle or distract fish and other potential predators. Some scientists call it the “burglar alarm effect”: by lighting up, the plankton draw even larger predators that, in turn, eat the animal threatening them. The phosphorescence only occurs when the microorganisms, which exist worldwide, are agitated – such as when the water crashes onto the shore, someone steps on the wet sand or a paddle hits the waves.

The phenomenon’s effects can vary depending on time of year and weather, so sightings cannot always be predicted. Even so, here are three spots where you’re most likely to see the sea shine with its own light.

Maldives

Visitors to the Indian Ocean archipelago say they have had the most luck seeing the blue glow from about July to February, especially during a new moon since the darkness of the sky helps intensify the light. The bioluminescence can occur throughout the country’s 26 atolls, but some of the most spectacular photographs have been captured on the grouping’s eastern islands, including Mudhdhoo, Vaadhoo and Rangali.

Puerto Rico

Mosquito Bay on the island of Vieques has the nickname of Bioluminescent Bay (often called Bio Bay) for the bright plankton that illuminates the water. Unexpectedly, the bay went dark in January 2014. Some scientists theorise that a wind shift pushed many of the microorganisms out of the bay, but the various factors that contribute to the bioluminescence make it difficult to say for sure.

Thankfully, the bay brightened again in June, although at a lower intensity. Though no one knows if the bay will return to full strength, tour operators are still running kayak tours Fridays through Sundays, as scientists work to study the bay the rest of the week in hopes of preserving the magical glow.

San Diego

There is bizarre bioluminescence in this Southern Californian city, too, caused when millions of phytoplankton form a group of algae so big they discolour the nearby water. Surfers see a “red tide” every few years, when these algal blooms give the sea a reddish tint by day and a bright blue phosphorescent glow by night. When the right combination of water temperature, wind, darkness of the sky and other factors come together, surfers and swimmers can glide through the water with a glow illuminating their way. Though some algal bloom can be harmful, the species common to San Diego, Lingulodinium polyedrum, is not considered to be toxic.