O2 sensor changed

i changed a O2 sensor on my mazda protege ES 1.8 and when i went to turn it on and put it on drive it just shuts off. Tired it again and it shuts off again and again any suggestion on why its doing it?

Nothing directly related to a new oxygen sensor should cause the car to stop running, but since the problem started at exactly the time of the repair, the smart money is betting that it is something that got disturbed in the repair process.

Re-trace your steps in the repair. Did you use ramps, a vehicle hoist, or a jack and jack stands to access the sensor? Where did you put the jack stands? Near a fuel line? What did you need to remove to plug in the oxygen sensor?

It is possible the sensor is wired wrong, unless it is a one wire sensor. If it is an OEM sensor, it could have been wired wrong at the factory, if it is an aftermarket sensor, it could simply be the wrong one, possibly mis-packaged.