By finding an extremely small loop hole and exploiting it. I read about a guy who managed to get a court signed form which knocked 10 years off his sentence.
He was out for weeks before they noticed. He wouldn't admit having outside help, but it was the only way to get it done. Since then the prison has tightened security in that area.