Bettas are often kept in community tanks. Care should be taken to avoid particularly brightly coloured or long-finned fish as this can increase the risk of aggression from the betta. Also, bettas should never be kept with other anabantoids (labyrinth fish) as aggression is nearly guaranteed between such species. Known fin-nippers should also be avoided as they can actually be quite dangerous to the betta. Beyond that, it often depends on the individual betta, the size of the tank, the other fish, and the general conditions.
It is probably also a good idea to have an additional tank available just in case aggression becomes an issue as the fish mature.
Adding the betta last can also sometimes help. If the betta goes in first, then other fish are entering his established territory. However, reversing the roles can help to reduce the likelihood of aggression. Again, no guarantees, just better odds.
Personally, I advise keeping bettas alone. It's difficult to guess how aggressive or mellow a betta will be ahead of time. If you do wish to keep other things in the tank with your betta, considering non-fish tankmates that enjoy similar conditions (water temperature, hardness, current, etc.) might be a good option.
Some common recommendations for betta tankmates:
1) African dwarf frogs - like bettas enjoy warm, calm, fresh water. Just be careful the betta doesn't eat all their food!
2) Snails - Apple snails and mystery snails are common choices, just be sure you have enough water volume and filtration to deal with the amount of ammonia they produce. You could also just throw in a few plain old pond snails. They do fine in my betta tank. :)
3) Shrimp - If you have lots of little nooks and crannies and hiding spaces in your tank, shrimp may be a viable option. Ghost shrimp and cherry shrimp are both fairly hardy and should do well in a betta tank as long as your betta doesn't decide to make them a tasty snack! Ghost shrimp as less likely to get eaten. Cherry shrimp are easier to breed (if that's something that interests you) and are better algae eaters.
4) Small peaceful bottom feeders - Corydoras catfish might be a good fit here if you have enough space to accommodate a small school. (They do best in groups.) They stay near the bottom and, in my experience, tend to be most active at night, so interaction with betta should be minimal.
5) White cloud mountain minnows - I have seen these recommended as betta tankmates many times. They are hardy fish and fast, agile swimmers who tolerate a wide range of water temperatures. Personally, I would reserve them for temperate, rather than tropical tanks, but they may still be a viable option. Again, I would recommend a school of 6-12, rather than a lone fish. This means having a tank large enough to accommodate them.
As an aside:
I would be interested to know what kind of fish you actually had in the tank. Usually, fish going by the common name "algae eater" are either Gyrinocheilus (Chinese algae eaters) or Crossocheilus siamensis (Siamese algae eaters). The Chinese algae eater (often confused with the Siamese) tends to only fulfill the "peaceful bottom feeder" role until it matures. Adult Chinese algae eaters don't tend to eat algae at all and are quite aggressive!
There are also many different types of plecos. However, the "common pleco" will actually grow to a fairly gigantic 18-24" and is generally not appropriate for the average home aquarium. Bristlenose and rubberlip plecos stay relatively small and are generally a far more appropriate choice for home aquaria, but are also harder to find.