When can minors be tried as adults?

Recent high-profile cases such as the 2014 Slender Man stabbing highlight the controversial practice of trying accused juveniles as adults. How do prosecutors decide which cases involving minors land in adult courts and which stay in the juvenile system? It's a complicated combination of laws, guidelines and judicial choice.