They know full well they are scatter gunning and that some small percentage of their ads will end up next to/in front of awful content. They know this - they've seen it happen time and time again. They continue to do it because it's cheaper to do so and occasionally take some PR flack and then blame Youtube.
Ultimately - your ad, your problem. If you value your brand so poorly that you don't care where you advertise, this is what happens.