Sticky ends are generated by the action of restriction enzymes, which cut DNA at specific sequences. For instance, the enzyme EcoRI recognizes the sequence GAATTC and cuts between G and A, leaving a 4-base overhang. These overhangs can form hydrogen bonds with complementary sequences, facilitating the ligation of DNA fragments.