> How could self-driving cars make ethical decisions about who to kill?

It shouldn't. Self-driving cars are not moral agents. Cars fail in predictable ways. Horses fail in predictable ways. 

> the car is heading toward a crowd of 10 people crossing the road, so
> it cannot stop in time, but it can avoid killing 10 people by hitting
> the wall (killing the passengers),

In this case, the car should slam on the brakes. If the 10 people die, that's just unfortunate. We simply cannot *trust* all of our beliefs about what is taking place outside the car. What if those 10 people are really robots made to *look* like people? What if they're *trying* to kill you?

> avoiding killing the rider of the motorcycle considering that the
> probability of survival is greater for the passenger of the car,

Again, hard-coding these kinds of sentiments into a vehicle opens the rider of the vehicle up to all kinds of attacks, including *"fake"* motorcyclists. Humans are *barely* equipped to make these decisions on their own, if at all. When it doubt, just slam on the brakes.

> killing animal on the street in favour of human being,

Again, just hit the brakes. What if it was a baby? What if it was a bomb?

> changing lanes to crash into another car to avoid killing a dog,

Nope. The dog was in the wrong place at the wrong time. The other car wasn't. Just slam on the brakes, as safely as possible.

> Does the algorithm recognize the difference between a human being and an animal?

Does a human? Not always. What if the human has a gun? What if the animal has large teeth? Is there no context?

> - Does the size of the human being or animal matter?
> - Does it count how many passengers it has vs. people in the front?
> - Does it "know" when babies/children are on board?
> - Does it take into the account the age (e.g. killing the older first)?

Humans can't agree on these things. If you ask a cop what to do in any of these situations, the answer won't be, "You should have swerved left, weighed all the relevant parties in your head, assessed the relevant ages between all parties, then veered slightly right, and you would have saved 8% more lives." No, the cop will just say, "You should have brought the vehicle to a stop, as quickly and safely as possible." Why? Because cops know people normally aren't equipped to deal with high-speed crash scenarios.

Our target for "self-driving car" should not be 'a moral agent on par with a human.' It should be an agent with the reactive complexity of cockroach, which fails predictably.