I'll be able to answer your second question, using the context of the census within 1 Chronicles itself.
David ordered his advisors to conduct the census after defeating Ammon and Aram (1 Chr 19:10-19, 1 Chr 20:1-3) and after Israel's armies defeated the Philistines and their giants - the Bible states that Elhanan son of Jair killed Goliath's brother (1 Chr 20:4-8). But remember, ancient Israel was structured that God (the Lord) was the reason that they prevailed against their enemies. So when David orders a census, it is to prove that he (David) was such a great king because now it will show numerically how many people he commanded.
His advisors warn him "May the Lord add to His people a hundred times as many as they are! But, my lord the king, are they not all my lord's servants? Why does my lord seek this thing?" (1 Chr 21:3) To number the people of God for earthly means (pride and taxation) was sinful since David was putting himself at the head of the Israelites instead of God.
However, the census wasn't truly accurate. Joab, who was to administer the census, counted men of military age but didn't count the tribes of Levi and Benjamin "for the king's command was abhorrent to Joab." (1 Chr 21:6). Joab is trying to shield David from the full wrath of God by misstating the numbers (even so they were impressive at 1.1 million in Israel and 470,000 in Judah).
At the end of the episode, Israel suffered a pestilence (chosen by David as his people's punishment for his wrongdoing) and David asks God to punish him directly instead. David builds an altar on Ornan's threshing floor where angels were standing and God is satisfied with David's offerings. And David gets the idea to not only build an altar there but to construct a temple for the Lord.
TL;dr: David wanted to show how amazing he was after winning wars and conducted the census out of selfish pride.
*I used the NASB translation for these quotes