Microscopic algae are arguably the source of more than half of the world's oxygen though photosynthesis. They turn carbon dioxide into biomass and release oxygen. Ecologically, algae are at the base of the food chain. They are the beginning of the transfer of solar energy to biomass that transfers up trophic levels to the top predators. Phytoplankton, are largely responsible for this primary production. Phytoplankton are mostly single-celled type of algae, that are in turn eaten by small animals called zooplankton (mostly crustaceans such as copepods) that drift near the surface of the sea. The zooplankton are in turn fed upon by larger zooplankton, small fish, and filterfeeding whales (think krill). Energy transfer happens and larger fish eat the smaller ones. At the top of the open-water food web may be fish-eating birds, seals, whales, very large fish such as sharks or bluefin tuna, and humans.
The larger algae provide a habitat habitat for fish and other invertebrate animals. A great example of this is Macrocystis, which is a keystone species in a giant kelp forest.
As algae die, they are consumed by organisms called decomposers (mostly fungi and bacteria). The decomposers feed on decaying plants and consume the high-energy molecules essentially remineralizing the biomass into lower-energy molecules that are used by other organisms in the food web.