They are designed to make the airflow close to the surface of the wing slightly turbulent (energised). This helps it to follow or "stick" to the curved surface of the wing as it moves from leading edge to trailing edge. It a trick frequently used where the wing is very cambered/curved (near the root) and isn't normally needed out near the tip where the camber is less. If the airflow "breaks away" from the surface it increases drag and reduces lift.