They work just like evolution, beginning with an inefficient solution, and then that is randomly modified by random mutation, after which the most efficient are retained for further mutation. Each generation becomes more efficient. Often the engineers aren't sure why the final result is more efficient; often the process uses effects that are subtle or poorly-understood.