Are you asking about any farm animals? Typically, males of most livestock species do not get sterilized. They are simply butchered. Cows, sheep, and chickens are treated this way. However, sometimes someone wants to keep a male as a pet or, in the case of wool sheep, for his fleece.
There are then several different methods of castration. The one that I have seen for sheep involves (with a lamb) fitting a tight, specialized rubber band around his testes to cut off circulation. After a few weeks, they can be removed with minimal pain and bleeding.