They're to make your car look awesome, and plus they help some cars hook or grab onto the road much easier and smoother, by pressing the rear end of the car down. Depending on how big the spoiler is. If it's just a small spoiler, then it's not going to be as effective.
They push the car to the ground. Seriously. The reason? If you didn't have spoilers on a really fast car, your wheels would lose contact with the ground, changing your car into a projectile with really useless wheels. The faster you go, the more wind the spoilers catch, pushing your car to the ground, creating more traction for the wheels.
Some years ago, on the Indianapolis 500, one of the raving teams thought an" wing" aerodynamic on the rear would hold the car better to the road and make the traction better, giving it an edge. Because they came out closer to #1, others copied, until regular auto maufacturers do that to some models after. Now, it's just one or two cars., not as popular.