Bangladesh's prime minister has resigned and fled to India following weeks of deadly protests in the country.