(If you haven't ever seen Casablanca, you might not want to read this post. Warning: Here there be spoilers!!!)
In the beginning of the film Captain Renault is a corrupt official, something he freely admits. He openly takes a bribes. He has a bill at Rick's Café Américain, but he never pays it. He cooperates with the Nazis, even though doing so goes against his own personal political beliefs. At the same time, however, there are clues that Louis is merely doing what he has to survive, not to mention support his lavish lifestyle, and that he is ultimately a good man. Indeed, he keeps Rick's Café Américain open, even though he knows visas have been sold there. While he denies it, I have to think Louis suspects that even Rick has sold visas at the club. Of course, Rick claims that Renault keeps the club open because he lets him win at roulette (something to which Louis admits). Despite this, I have to think that much of the reason that Louis keeps the club open is of his friendship with Rick.
What is more, I think it's likely Louis admires Rick because Rick ultimately has principles. At one point Captain Renault points out that Rick ran guns to Ethiopia in 1935 (this would have been during the Second Italo-Ethiopian War, when Ethiopia fought the invading Fascist Italy) and in 1936 Rick fought on the Loyalist side in Spain. As Louis points out, in neither case was Rick on the winning side. Louis also admits to Ilsa that were he a woman and he was not around, he would be in love with Rick. When Major Strasser (played by Conrad Veidt) refers to Rick as "...another blundering American," Captain Renault warns him against underestimating "American blundering". Even when Louis tells Rick that he is going to miss him because he is the only one with less scruples than he has, it seems clear that he thinks Rick does indeed have scruples. What is more, it is clear that he wishes he had scruples as well.
That Louis does have some scruples can be seen on those occasions when he lets his own personal beliefs slip. He even does this with Major Strasser, a Nazi who could easily have him sent to a concentration camp. When Captain Renault tells Rick that they are honoured as Major Strasser "is one of the reasons the Third Reich enjoys the reputation it has today.", Strasser points out that he says "'Third Reich' as if he expected there to be others." It seems clear that while Louis cooperates with the Nazis, he has no respect for them. Combined with his admiration of Rick, it would seem Captain Renault does have some morals, even if he has chosen to ignore them for the moment.
One has to suspect that on some level Rick realises there is a good man deep inside Captain Renault. Indeed, Rick trusts Louis more than one would reasonably expect the proprietor of a nightclub to trust a corrupt official (even a poor one). And one has to suspect that trust has to go further than knowing Captain Renault can be paid off with a big enough bribe. I think that perhaps Rick saw in Louis a bit of kindred spirit. Rick lost his way when his heart was broken by Ilsa. Louis lost his way when his home was invaded by the Nazis. While Rick has the strength to somewhat stand by his convictions, he perhaps realises that Renault does not. Rick may well realise that Louis was an essentially good man who found himself in dire circumstances and simply did what he had to do in order to survive (not to mention continue his life of women and gambling).
Fortunately, Rick does ultimately bring out the good in Captain Louis Renault. Louis watches as Rick sacrifices rekindling his romance with Ilsa in order to help in the fight against fascism. This gives Louis the strength to make his own stand. When Rick shoots Major Strasser, Louis simply advises the local police to "round up the usual suspects", full well knowing it was Rick who shot the Major. And it is Louis who suggests to Rick that they join the Free French in Brazzaville. In the end Captain Louis Renault is redeemed by the sacrifice Rick made to aid in the war.
At the end of Casablanca Rick tells Louis, "I think this is the beginning of a beautiful friendship." While it would seem that Rick and Louis had been friends all along, the statement affirms that both men have once more regained the strength to stand by their convictions. One can only think that the two of them served valiantly in the Free French Forces and ultimately came out of the war the better for it. Whether Rick ever reunited with Ilsa is debatable, but I have to believe Rick and Louis remained friends throughout the war and beyond.