Ok, to make it simple for new people, like I was:
Ammonia is excreted by fish in the form of poop. It is toxic to fish, but in a cycled tank, bacteria all over the tank(eg. filter, filter media, plants, substrate, gravel etc.) break up the ammonia into nitrite, which is also toxic. However, there are also other bacteria that can break up nitrite into nitrates, which is less toxic, and is taken out of the water when you water change, but some plants also take that out of the water, like floating plants(duckweed, frog bit, anacharis etc.)
However, in an uncycled tank, there is no beneficial bacteria to speak of. You can add some by buying bacteria in a bottle. This basically gives your tank an injection of the good bacteria.
There are 2 types of cycling: fish in and fishless cycling. Fish in cycling is straightforward - the fish are in and you test the water every day to see whether there is too much ammonia/nitrite. Whenever there is more than 0 of either, you water change. You know when a tank is cycled in a fish-in cycling when ammonia and nitrite read 0 for a week straight. The nitrates you don't really worry about.
There's also oxygenation. Oxygen must be in the water for fish to survive, although some fish (including bettas) can gulp air from the surface. In order to oxygenate, you have to either (1) create water movement every 10 minutes or so, (2) have lots of live plants in the tank (this is how filterless tanks work), (3) have the filter running 24/7 (this should always be happening unless you're doing a filterless tank, which has tons of plants)
You have to turn the filter on always if you want your fish to survive.