Colorado State University has two helpful pages that explain the main procedures (h/t Tom). Semen Collection goes through the 3 ways that are used to collect semen from animals.
Semen Collection from Bulls helpfully expands on bulls specifically:
Semen is most commonly collected from bulls in bull studs using an artificial vagina, as described below. Electroejaculation is an alternative method used with bulls that cannot mount or are too fractious for easy handling (e.g. range bulls). Finally, semen can be collected by message of the seminal vesicles and ampullae per rectum.
In a nutshell an Artificial Vagina (AV) uses thermal and mechanical stimulation to stimulate ejaculation. In the image below, the top item is an AV for use with rabbits and the bottom one is an AV for use with bulls. (The middle item is a director cone, which is used to collect semen from dogs.)
The procedure revolves around using a steer as a teaser to arouse and mount the bull, and then having an operator divert the penis the AV:
As one of the pages helpfully explains:
Prerequisites to use of an AV are that the male be conscious, not significantly frightened of people, and more interested in ejaculating than in killing humans.
The main alternative for less docile bulls appears to be electroejaculation, which involves applying a series of short, low-voltage pulses of current to the pelvic nerves which are involved in the ejaculatory response. You then collect semen using a director cone much like the one in the image further up.