There are different ways to achive this. You can do it directly within the process of tfs by implementing an ISubscriber and listening to the WorkitemChangedEvent:
http://www.almguide.com/2011/12/tfs-server-side-event-handlers/
Or using the client API you can register a wcf service to get notified for workitem changes. So you can implement the logic on a different tier.
You can find both implementations here:
http://tfswiwatcher.codeplex.com
The 2010 Version uses the client side way and the 2012 and 2013 versions are using the server side way.