…and if you do not redeem it, you must break its neck. (Exodus 13:13)
If the owner for some reason does not want to redeem the donkey, then he must sever its neck with an axe blow. This is because it is forbidden for him to derive any benefit from the donkey unless it is redeemed. (He’s not even allowed to skin the carcass after breaking the neck; all benefit is prohibited.)
It should go without saying that it’s preferable to redeem the donkey than to sever its neck, but the Mishna in Bechoros (1:7) does spell this out explicitly. Nevertheless, the owner of the donkey does have this option, just like the brother of a man who dies childless has the option of yibum or chalitzah. (That refers to performing either a Levirate marriage with his brother’s widow or the “shoe-removal” ceremony. We’ll come to this in Mitzvos #597-599, in parshas Ki Seitzei.)
The Rambam, in his Sefer HaMitzvos, says that one might reasonably expect redemption of the donkey and severing its neck to be one mitzvah with two possible courses of action. However, as logical as that might seem, we see explicitly from the Talmud that these are in fact two separate mitzvos and the owner can choose to perform either one.
You can find this mitzvah in the Talmud in Bechoros 13a and in the Shulchan Aruch in Yoreh Deah 321. This mitzvah is #82 of the 248 positive mitzvos in the Rambam’s Sefer HaMitzvos and #56 of the 77 positive mitzvos that can be fulfilled today as listed in the Chofetz Chaim’s Sefer HaMitzvos HaKatzar. As with the previous mitzvah, applies to both men and women, in all times and places, but only to Yisraelim and not to kohanim and Leviim.