How do the bacteria get the plasmids from other bacteria? Do they consume other bacteria, or is there a mechanism by which some bacteria provide DNA segments for others?

Also, how do they incorporate the new DNA into their genome?