Generally speaking, 「無くす」 would be a more versatile word than 「失う」 as the latter is a more nuanced word. While 「無くす」 is an everyday word that even toddlers can use actively and correctly, you will not see small kids using the word 「失う」 in real life. I think it safe to say that 「失う」 is used more often in writing than in speaking.
Only 「無くす」 can be used to talk about losing "little tangible" items such as a book, keys, hat, cellphone, umbrella, etc. You would sound incredibly weird if you used 「失う」 instead.
To talk about losing more important things, tangible or intangible, you can basically use either word as long as you remember that 「無くす」 would tend to make it sound more conversational. Those items would include a house, job, life, confidence, rights, etc.
As shown in your last example, only 「無くす」 can be used to talk about making something unnecessary or evil disappear by human effort. 「失う」 cannot be used there at all. 「失う」 can only be used to talk about losing something you did not want to lose.