2 Samuel 24:1 Again the anger of the Lord burned against Israel, and he incited David against them, saying, “Go and take a census of Israel and Judah.”

2 So the king said to Joab and the army commanders[a] with him, “Go throughout the tribes of Israel from Dan to Beersheba and enroll the fighting men, so that I may know how many there are.”

a. 2 Samuel 24:2 Septuagint (see also verse 4 and 1 Chron. 21:2); Hebrew Joab the army commander

I got the opening commentary from blueletterbible.org.

The anger of the LORD was aroused against Israel, and He moved David: The translators of the New King James Version believe that "He" in this sentence applies to God, because they capitalize it. Yet 1 Chronicles 21:1 tells us, Now Satan stood up against Israel, and moved David to number Israel. The best explanation is that Satan moved David and is the "he" of 2 Samuel 24:1. Yet the LORD expressly allowed it as a chastisement against David.

"Now the 'he' there, we assume would be the Lord. But as we find out in 1 Chronicles, chapter one, it was Satan that moved David's heart, to the numbering of the people. So God opened the door, and allowed Satan to move in and tempt David." (Smith)

Go, number Israel and Judah: This was dangerous because of a principle stated in Exodus 30:12: When you take the census of the children of Israel for their number, then every man shall give a ransom for himself to the LORD, when you number them, that there may be no plague among them when you number them.

The principle of Exodus 30:12 speaks to God's ownership of His people. In the thinking of these ancient cultures, a man only had the right to count or number what belonged to him. Israel didn't belong to David; Israel belonged to God. It was up to the LORD to command a counting, and if David counted he should only do it at God's command and receiving ransom money to "atone" for the counting.

This is from Bible.org.

For some reason not indicated to us, God was very angry with Israel. Our text literally says that God’s nose burned. God was “hot” over Israel’s sin. All too often in the Old Testament, this expression of divine anger is employed. In each case, it is a serious sin that inflamed the righteous anger of God. Once again, God is angry with Israel, and He is determined to divinely discipline this stiff-necked people. He does so by utilizing David’s sin. Somehow David’s sin brings both guilt and punishment on the people. In focusing our attention on David and his sin, let us not forget that this incident takes place because of Israel’s sin.

It should be pointed out that the census which David required here does not appear to be a mere numbering of the Israelite warriors, a simple matter of counting heads. This census took nearly ten months to complete, and somehow it required the participation of the military commanders themselves. My understanding is that when the soldiers were numbered, they were also ranked. In other words, numbering the soldiers involved ordering and ranking them, so that they would be ready to fight.

It is clear from this text that there is something less than pious about having to number the military. It is an evil for which atonement must be made, and if it is not, a plague will come upon the nation.

At first I was wondering... "What has David done now?" Reading the commentary doesn't help much. See, I can't tell if David got a bug and took a census or if God "allowed" Satan to do something. That's the way it happened in the book of Job. It seems to me that if God was going to "allow" Satan to do anything, it would serve God to tell us He allowed Satan to get to David. That way all the boo hiss would be on Satan and David with God on a pedestal. But that's not how this is written. On top of that this same story is apparently written in two books of the Bible with slightly different points of view. So if Satan was going to take the blame.... God would have made sure one of those two scribes gave us the real reason for such a critical incident.

The problem is.... in accordance with Genesis 30:12 if you count someone... they have to pay an atonement. Everyone is messed up somehow.... we all do wrong sometime or another.... we have bad thoughts... and bad attitudes... and we make horrible decisions.... so when someone is counted [or numbered or pointed out] up pops all our horrible thoughts, attitudes and decisions.

My mother had alzheimer's disease. When it started Mom revealed what she called a "good thing". Everyone's baggage was gone. When she saw someone... they didn't carry all the crap that made up their history... she only saw them. "So no one had anything to be counted against their character."

I don't care if it was David or Satan who should take blame for the census. The issue with the census is.... someone is going to die now. And... since this is Biblical... my guess is... unless something big takes place.....a lot of people are going to die.