I mainly talk about green spot algae (GSA) and diatom algae here because they are common in aquarium.
An alga is a single-cell vegetation.
When there is direct light, there are algae.
When there is extensive light (such as direct sunlight), the water will even turn green.
It is merely an appearance problem.
In fact green algae are good for the tank environment.
Either clean up the algae manually or buy a special fish to do the job.
For diatom algae, if they are not cleaned away when they newly appear, they will attach harder on tank wall and finally kitchen wire scourer or a slice of tender coconut shell has to be used to rub them off.
Algae affect appearance so they should be brushed off whenever they are seen or else it defeats the decoration purpose of an aquarium.

Do not use algicide to control algae.
Use of chemical is unnatural.
Remember the mindset in keeping an aquarium is to mimic the nature.
Do not use UV sterilizer too because it may affect good bacteria.

2.0 Algae control by tank setup

Having plants in the tank will stun the growth of algae to a certain degree because they compete with algae for nutrient.
Anyway algae are very good in scavenging trace of nutrient.
If there is plant in the tank but algae still grow vigorously, control the nutrient to the algae by
1) not overfeeding the fish.
Even plants cannot eat up that much nutrient.
Unabsorbed nutrient will be fully utilized by algae.
2) switching off aquarium light (and ambient room light) before going to bed.
If the water is green, do not turn on the light at all even there is plant.
The fish cannot be seen clearly anyway in green water.
Wait until the water becomes crystal clear again before turning on the light.
3) changing water more frequently to decrease the amount of nutrient in the water.
When rubbing some algae off, do change some water to purge some alga cells away.
If the water is green, change some water and wash the filter floss (in the water taken out from the tank) everyday until the water becomes clear.
4) not overcrowding the tank (controlling number of inhabitants).
Both nutrients and CO2 needed for algal photosynthesis will be less.
5) ensuring effective filtration.
Try stopping the filtration and we will see that the water becomes cloudy and then two weeks later becomes green.
6) Put the tank away from the window that has daylight.
But the aquarium light should be turned on for at least several hours a day because the fish (in fact all common animals) need light to stay healthy.

Another way to control algae is to use filter that increases water movement.
Alga cells cannot attach on surface easily when the water is flowing.
That explains why streams have less algae patches than ponds.

Algae feed on nitrate. Nitrate filter can help reduce algae.

3.0 Manual algae control

A used toothbrush or a sponge are effective algae cleaning tools.
Sponge is faster than toothbrush due to the larger surface.
One drawback about cleaning algae this way is the fish will be disturbed, especially if the tank is small.

Another manual way to reduce alga cells is to put in a few beautiful rounded stones (size about a chicken egg).
When algae grow on them, take out the stones, brush and rinse off the algae.
By the way do not put the stones back to the same spot.
Put them at the another end of the tank.
This is because dirty things may accumulate under the stone so it is better to let the previous spot aerate itself.
Clear away any dying plant leaves too because decomposing leaves produce nutrient.

There are algae scrubbing tools in the market.
One of them is called floating "algae magnet".

4.0 Biological algae control by fish, shrimp or snail

Note that only fish with sucker-mouth and snails can clean hard attached thin layer spot algae on all surfaces.
Good algae eaters has algae as main diet. Also to prevent starvation, the number of algae eaters should be adjusted to algae growth rate.

4.1 Efficient

4.1.1 Cateogry fish

Siamese Algae Eater

Siamese Algae Eater (Crossocheilus siamensis), in short SAE, is also known as Siamese Flying Fox.
It can eat red algae.
My SAE survives in a fish bowl with growing algae.
I can see green poop in it.
It will take pellet food too if given.
Its color turns pale until the black stripe is gone if it is under stress.

My SAE with a deformed eye

Some points to take note:
1) SAE may be aggressive towards other fish and small shrimp (e.g. my cherry shrimps were killed, my cardinal tetras were always chased after and nipped).
2) SAE may jump out of the tank. Mine died due to this.
3) When buying SAE, see that none of its eyes is deformed.
Both eyes should have decent pupil shape and size.
4) Recognizing a true SAE is a little tricky (see below).

Oto

Oto (Otocinclus spp.) eats up hard attached algae, including those on plants.
Oto also eats away algae that have just got a foothold on a surface and have not shown the green color yet.
Due to its small size (not longer than 40 mm), it can eat algae in some hard-to-reach areas.
Even ensure there is abundant light and surface (e.g. more stones and plants) to grow algae.
Occasionally when the tank has no sight of algae, feed otos blanched zucchini (blanching softens the vegetable for oto to eat).
Oto may suck on discus fish but that rarely happens unless it is very hungry.
Oto is less hardier than Pleco.
Requirement for survival:
drip acclimation, plants, minimum two otos, not adding salt, heavy filtration.
Oto needs heavy filtration because it is sensitive to water quality and is rheophilic (rheophilic means preferring fast-moving water).
When buying, choose the one with tail fin spread out and with big belly.

Bristle-nose Plecostomus

Bristle-nose Plecostomus (Ancistrus species, e.g. Ancistrus temminckii), unlike other Plecos, will not grow to more than a half-foot long and will not suck on slime coat on other fish.
But like other Plecos it is as messy as Goldfish and it may need a small piece of wood at the bottom of the tank to play with.
When starving it may target on live plants.
Like other Plecos, it can clean very thin hard attached algae layer on the tank wall.
It also likes some fresh kitchen waste (cucumber etc).
There is an albino variety.
If the Bristle-nose cannot be found, get a common Pleco first since it is commonly available and cheap.
The smaller the common Pleco the better because it will grow.
Some common Plecos may not effectively clean away algae anymore when they get used to fish food.

Twig catfish

Twig catfish (Farlowella spp.) is less common and cannot be easily found in fish stores.
It is very sensitive to water condition.

4.1.2 Category shrimp

Get at least three shrimps because companionship is a must for them.
Note that these fish will eat even adult shrimps: dwarf puffer (Carinotetraodon travancoricus), dwarf gourami (Colisa lalia).
Note that they will stress out if they do not have uneven surface such as rock, wood or plants to climb on.

Amano

Amano Shrimp (Caridina multidentata, previously Caridina japonica) eats algae.
It is also called Yamato Shrimp because it is found in Yamato River in Japan.
It will not feel helpless in the net out of water but on the contrary they crawl out of the net and drop to floor and run like a cockroach.
It will eat your plant and may attack your fish if there are no algae and other food.

Cherry

Cherry Shrimp (Neocaridina heteropoda var. red, mostly known as Neocaridina denticulata sinensis var. red) is hardier, smaller, prettier and more effective than Amano.
So I prefer cherry shrimp.
Cherry shrimp can be fed with blanched zucchini or blanched carrot if there is not much algae.
Cherry shrimp can reproduce fairly easily.
The fries do not go through larva stage.
This shrimp can stand still on the vertical tank wall.
They need plants (I recommend Java Moss) and some salt in water to live well.
Please note that Siamese Algae Eater may pick on cherry shrimp so do not take chances by putting them together.

Hawaiian Red

Hawaiian Red Shrimp (Halocaridina rubra) or called "opae ula" in Hawaiian (meaning red shrimp) survives in freshwater or saltwater.
But like Amano Shrimp, its shrimplets cannot survive in freshwater.
Its size is smaller than Cherry Shrimp but it has longer lifespan than Cherry Shrimp.
Some businessmen exploit its super hardiness by selling it in "torture-sphere" (please boycott those).

4.1.3 Category snail

Cover the tank because snails can climb out.
Do not put any puffer fish including the dwarf species in the tank because that fish will eat the snail.

Malaysian trumpet snail

Malaysian trumpet snail (Melanoides tuberculata) or MTS is nocturnal critter.
It cleans up some algae.
It also scavenges on dead plants and leftover food.
You can keep one but you should be ready of overpopulation because it is a livebearer.
In case of population explosion, control them with a clown loach (Chromobotia macracanthus).
They may eat a little bit of live plants when there is nothing else to eat but the damage is minimal.
It may not on purpose uproot newly rooted plant because it constantly aerates the gravels.

Zebra snail and ruby snail

Zebra snail and ruby snail (Neritina spp.) are small, beautiful and also effective algae cleaners.
These snails only breed in brackish water.
If there is already other algae eater in the tank, feed the snail with algae wafer or simply avoid keeping the snail in that tank so that it will not starve to death.

4.2 Inefficient

Molly (all types including black molly Poecilia sphenops and black lyretail molly Poecilia latipinna), Platy and Butterfly Goodeid (Ameca splendens) snack on algae.
They cannot wipe the wall clean like Bristle-nose Pleco.
I have seen my Red Albino Sailfin Molly picking on the tank wall (male a lot more frequent than female).
I have seen my red platy discharging green poop.
Buy them because they look good, not because they eat algae.

Red-fin Shark (Epalzeorhynchos frenatus) is also known as Ruby Shark or Rainbow Shark.
It sometimes rasps on tank wall.
It only snacks on algae and cannot do the clean-up effectively.
It needs a place to hide so the tank must be heavily planted or there must be a cave.

Chinese Algae Eaters (Gyrinocheilus aymonieri), in short CAE, just SNACK on algae when fish slime and fish food are abundantly available.
They tend to prefer to rasp at (or latch onto) the sides of slow moving fish. They are usually seen at a small size and many die within a short time of purchase.
They stay under 6 inches.
The Albino Algae Eaters or Gold CAEs are albino variety of Chinese Algae Eaters.

Apple snail, also known as mystery snail (Pomacea spp.) eats a little algae.
I once had an apple snail and the tank was green with algae.
It leaves trails on the algae field, not clearing the whole field.
Apple snail poops a lot.
Some apple snail species eat little algae.
Some eat more algae.
The apple snail species are differentiated by egg color, whether it destroys live plants and whether it munches lettuce (the one that I kept did not eat lettuce).
Do not take the risk of losing plants to find out the correct one.
Ramshorn snail (Gyraulus spp.) is another snail that eats small amount of algae and may risk the plants.

Other species that eat just a little algae: the inexpensive Ghost shrimp (Palaemonetes spp.), American Flag fish (Jordanella spp.)

5.0 Black brush algae

Black brush algae (BBA) hit my aquarium before.
It came along with the Anubias plant that I bought.
Originally it was just one brush.
I did not know that it was the notorious ugly BBA.
Then the one brush became many brushes.
It usually grows at the edge of the leaf on slow growing plant, bog wood and plastic.
It absorbs more light due to its black color.

5.1 Efficient

1) Change water daily.
I discovered BBE booming after I came back from vacation (no water change during the vacation).
2) Boost the growth of your aquatic plant by providing CO2, strong botanical light etc.
Limiting botanical conditions will not stun BBA because BBA thrive well so it is better to provide more botanical condition so that your aquatic plant can fight with BBA.
When aquarium plants grow well, BBA is nowhere to be seen.
CO2 does not kill BBA directly, but indirectly by encouraging other plant to snatch the nutrient that BBA also needs.
Other plant should be of the type that grow faster than BBA.
3) Silver flying fox (Crossocheilus reticulatus) is known to eat BBA.
4) Wash the aquarium (tank, filter, gravel etc) thoroughly and put under hot sun for one day.
Put bog wood that has BBA in boiled water.
Abandon filter element. Treat the plants with chemical separately.
Put the plant (only for plants that grows on wood or rock such as Anubias and Java Fern) in water mixed with chlorine, bleach, hydrogen peroxide, glutaraldehyde or copper for a few hours.
Glutaraldehyde makes BBA turn pinkish red and die.
Glutaraldehyde, hydrogen peroxide and copper can be used directly in aquarium but beneficial bacteria, shrimps and snails will die.
Chemical control should be the last resort.

5.2 Inefficient

1) Trim the edge of the leaf where BBA grows.
Discard the leaves that are heavily infested.
When it appears again, eliminate it manually immediately.
This is a painful process.
2) SAE eats just a little of it.
Some SAEs do not even touch it.
So at least ten SAEs should be obtained.