They only work if you have a vitamin or mineral deficiency. The only way to know if you do is to have your blood tested for specific vitamins and minerals. If you take more water-soluble vitamins (like vitamin C) than you need, it just makes expensive pee. If you take more fat-soluble vitamins than you need, they can accumulate in the body and cause problems.
I take a prescription multivitamin because I have nutrient absorption issues due to medical problems; they're covered by insurance, so they're not very expensive. Prescriptions are manufactured to strict specifications, so they contain what's on the label. Over-the-counter meds and vitamins/minerals are not regulated by the FDA and studies have shown that sometimes they don't contain what the label says.
Most people who are in general good health and eat a diet mostly based on less-processed foods get all the vitamins and minerals they need.