The cassette is a very important part of the "drivetrain" on any bike, cassettes are only used on a geared bike. The chain connects the front and rear sprockets (cassette) on the bike and provides the drive to the back wheel. A badly worn cassette in the same way as a worn chain will slip and can be dangerous under high loads such as sprinting or riding up hill. A badly worn cassette can wear out other components sooner than if it was looked after or replaced. The cassette needs to be kept clean and there are many different brushes on the market which will help with cleaning the cassette while it's on the bike without having to remove it. Cassettes for road bikes and mountain bikes vary by the teeth ratio and they are generally closer ratio on a road bike than on a mountain bike. There are many different combinations of sprocket numbers and teeth sizes. You should make sure the bike will be able to cope with the different ratios if you plan to change the teeth sizes as this will change the length of chain that is optimum on the bike and sometimes the rear Derailleurs may need to be changed to cope with an increase or decrease in sprocket sizes. You would not be able to change the number of sprockets that make up the cassette on the bike without changing more components such as the shifters and derailleurs.The difference between a cassette and a freewheel is due to the fit of the component. A cassette slots onto a freehub body. This freehub body is attached to the rear wheel and allows the cassette to spin freely one way and not the other. A freewheel screws onto a thread on the rear hub. The freewheel has a ratchet system (its own freehub in essence) built within.
Cassettes range from 7 speed to 11 speed currently and most freewheels you see will be 5 speed to 7 speed although you can come across the odd 8 speed version of these.