The other answer is too general for BMX and some things don’t apply, or are even bad advice for BMX handlebars.
- Check that both the stem and the bar are not "crushed" (if they’re brand new, they’re obviously fine)
- Remove paint from clamping areas. Usually stems do not have paint on the inside clamping area. On the other hand, some handlebar manufacturers do not bother protecting the clamping area during painting. If you have paint on the clamping area, this reduces the overall clamping friction. You should sand that paint, but it’s not 100% mandatory.
- Remove dust, debris, etc. There should be nothing in between the stem and the bar that could cause slippage. DO NOT GREASE THE CLAMPING AREA.
Tightening the bolts
The main reason why handlebars get crushed like this is because of uneven tightening of bolts. BMX stems almost always have 4 bolts (either top-load, or front-load).
Here’s an example of a typical top-load stem:
When tightening the top bolts of the stem to your handlebar, you need to follow an even cross-like tightening pattern, such as this one:
- Screw all 4 bolts into the stem by hand until you feel a bit of resistance.
- Make sure that the top cap of the stem has even spacing all the way around. If not, screw/unscrew slightly the bolts until it does (see image below)
- Tighten the bolts 1/2 turn at a time, one after the other, following the above pattern. This will ensure that all bolts have roughly equal tightness and that the stem cap is evenly spaced.
- Tighten until it becomes hard to tighten by hand. Don’t overtighten the bolts. You should grease the bolts to allow better tightening (the bolts, not the clamping area!)
- Check that everything’s okay by pulling and pushing hard on the bars. They shouldn’t slip at all.
Regarding 2, here’s a quick sketch up of what I’m talking about. This is a side view of the stem:
The spacing in 1 is even, this is good. The spacing in 2 (exaggerated) is uneven, this is bad. This spacing must be even on all 4 sides.