There are multiple ways in which you can re-run failed tests.
1. Use a retry analyzer and implement the retry running of tests using this.
2. In CI systems such as Jenkins, you have the option of adding a post build step wherein you can write up a simple shell script which basically checks if there is a testng-failed.xml file available in the test output path and if it is available then kick off the build [ by running either the ant task or the maven task ] by providing the suite file to be executed as testng-failed.xml
Note:
Approach 2 is going to be messing up your test results (if you are dependent on the default reports that TestNG provides) because it would get overwritten. So you may have to put in additional checks in those areas as well.