There are two main theories as to why Napoleon chose to sell Louisiana:
1- He became more interested in battling GB directly, and lost interest in the west. He found his new destiny in Europe and the Middle East.
2- Wanting to placate the US, he was concerned that they were going to take the territory by force. He's out of men, ships, and money, thanks to Santo Domingo. He had little chance of winning a war over it, so he might as well make some money with it. However, if he had only needed money, he would have sold it back to Spain for much more- that would have been unstrategic, since Britain probably would have just taken it from them. In addition, they had backed out of giving him Spanish Florida and he was still mad about it.
Bonus- this embroiled relations between the US and GB, since neither wanted the other to have it, and the US was dominant there economically anyway.
12 million dollars were paid to France, paid in bonds redeemable in 15 years at 6%. US also assumed claims against France for damages/losses during Quasi War- another 3 million dollars. Total: 15 million dollars.