How does voice recognition work?

When i mean voice recognition, i actually mean something else but i just didn't know the term used, but what i'm trying to ask is how does things like siri on the iphone work? How does a computer generated voice in an object communicate and respond to you talking? Or if you tell a device to switch of or turn on, how does just speaking make it do the actions?

Added (1). How would one create this program?

A programme written on a computer that when the microphone hears you say a word it makes the phone do the action, much like pressing a button, u press d, a d appears

I would say that they write a programme and then record many different people with different accents and in some way incorporate that into the programme as if you just used one accent I would guess that when the computer trys to understand this with different accents it would run into problems - I also think this is why the technology still is not perfect and you still get mistakes here and there. But then again I could be wrong and I could just google the answer but thats just my best guess without further research but I can't be bothered.

One?

You're off by a couple of orders of magnitude. Speech recognition belongs to the more complex problems of computer programming. Start with a team of ~100 people.

You might start off with the wikipedia article: http://en.wikipedia.org/...ecognition