As cities grapple with how police departments should change in the wake of nationwide protests, questions are being raised about how troubled officers have been allowed to stay on some police forces, even when their own department doesn’t want them.