Genetic algorithms work by maintaining a population of candidate solutions to a given problem. These candidates, often represented as strings of numbers (akin to chromosomes), are evolved over multiple generations. The process involves selecting the fittest candidates and using them to produce a new generation through crossover and mutation. Over time, the population evolves towards an optimal solution.