In 2 Samuel 24:1 the bible says that God made David want to count the people but in 1 Chronicles 21:1 it says it was Satan so why the huge confusion and why were the people killed and nothing happened to David even though it was his sin?
This is a difficult question because it appears to be one of those rare places where the copies and translations may not been accurately preserved throughout the centuries. However, I believe that we can figure out what the original manuscripts said. As you noted, 1 Chronicles 21:1 reveals that it was actually Satan (not God) who rose up against Israel and incited David to take the census. God apparently allowed Satan to tempt David into this sin for the purpose of punishing the people. So, David committed a personal sin when he conducted the census. This was wrong because it was done in pride and self-glory, so that David could be proud about being the leader of so many people. However, God’s overall purpose here was to punish the people, which He did by taking many lives. However, David was only the tool that He used for this overall purpose.