That's where all the work to map genomes and identify genes comes in handy. From the donor organism, cut up the DNA with restriction enzymes.
Restriction enzyme recognize specific nucleotide sequences, and cut the DNA at that sequence.
The fragments have one to many genes each, and are sometimes called restriction fragments. The carrier is a virus or a plasmid. So viruses are well-suited to get genetic material into cells. A plasmid is a small strand of DNA in bacteria that are separate from the bacterium's main chromosome. Bacteria will take up plasmids.