How do scientists kill the bacteria they themselves made resistant?
You are absolutely right, flushing down the toilet (or the sink) or simply throwing them into the normal waste doesn't work for biosafety reasons. And it is also not allowed, depending on the country you would do this in, this can lead to hefty fines.

Biologically contaminated lab waste can be inactivated (=all potential dangerous organisms are destroyed) by two ways: Either by heat or chemically. Which ways is used, depends on the kind of waste.

The most commonly used way is autoclaving, meaning treating the waste with steam at high temperatures at higher pressure. The temperature used here is usually 121°C, the exposure time depends on the volume of the waste, since the temperature needs to be reached and kept for at least 20 minutes. See the references for more details.

Liquid wastes (like culture media) can also be inactivated chemically by adding chlorine bleach to decompose the cells. Bleach can also be used to decontaminate surfaces, although here more often alcoholic solutions (70% Ethanol or Isopropanol) are used. After chemical inactivation, the remaining solutions should not be autoclaved as the emerging fumes are either unhealthy (bleach) or explosive (alcoholic solutions) and this is unnecessary, too.
Liquid wastes can also be autoclaved to inactivate them. 

Autoclaving has the main advantage that it is rather simple (put the waste into the autoclave, close it and run a appropriate program), the waste can afterwards simply be discarded as normal waste, which may not be the case for chemically inactivated waste, which may need special precaution for disposal.

References:


Decontamination and Sterilization
Decontamination of laboratory microbiological waste by steam
sterilization.
TECHNIQUES FOR STEAM STERILIZING LABORATORY WASTE
Decontamination of Laboratory Microbiological Wasteby Steam Sterilization