In order to understand what's happening in In the Heat of the Night you have to realize that it is set in a very specific time period. The Civil Rights Act had been passed in 1964 and the Voting Rights Act was passed in 1965. But the impact of those laws was only beginning to be felt.
Especially the Voting Rights Act. The town of Sparta, Mississippi where William Schallert was Mayor and Rod Steiger was sheriff now has a significant new voting population and blacks might be a majority in that county. But even if they aren't, they know have a voice in the electoral process. Someone like Steiger has to take that into account now. Of course some of his deputies might not yet be with the program which explains why when a murder/robbery is committed of a very prominent northern businessman, Warren Oates sees fit to roust Sidney Poitier who's an unfamiliar black face in that town.
What a surprise they all get when they find out he's a top Philadelphia, Pennsylvania homicide detective and when his identity is established, his boss in Philly offers his services.
Poitier and Steiger both have to work through their prejudices, how each sees the other to solve this mystery which writer Stirling Silliphant gives us several red herrings before we learn the truth. Though Steiger got the Oscar for Best Actor, it should really have been a joint award. Their conflict and growing respect for each other drives the film. Steiger needs his expertise and respects him for that and Poitier comes to respect Steiger for his honesty.
Norman Jewison got great performances from his stars and the supporting cast of whom Warren Oates as the dimwit redneck deputy really shines.
Though set in a very narrow period of our history, In the Heat of the Night holds up very well with some eternal truths in its story. And it's the story of times that were a changing as one spokesman of the sixties put it.