Insurance cannot prevent something bad from happening. But it helps us recover financially if something does happen to something we value.
When you buy insurance, you pay a premium. This premium joins a pool of premiums from other policy holders. The money from this pool is what is used to pay your claim if the insured event occurs. Insurance companies leverage on spreading risk among a large group of people.
Once a claim is lodged, depending on the type of policy you took, the insurance company will come in and assist through rebuilding/repairing, replacing, providing cash settlement or any other form of compensation as per policy agreement.
Insurance Companies also need insurance to be able to cover the risks they have insured, this is called Re-Insurance.