Adding non-clustered indexes depends on the query being executed. Generally, you want to look at the WHERE clause or the ORDER BY clause and anything those are filtering on will generally benefit from the index.
Now on the other hand, an index is essentially a copy of the table data you are including in the index. So if you have a 10 column table and have an index on 2 of the columns, those 2 columns (plus the clustered index key(s)) are going to exist in the table (either a heap or a clustered index) AND in the index. And if you have any INCLUDES on the index, those are replicated in the index as well. So you can imagine what this does to space over time. Plus, it will affect performance of INSERT, UPDATE and DELETE statements as you need to insert, update, or delete from the table AND the indexes.
So adding indexes blindly is a good way to hit performance problems,but also removing indexes blindly is a good way to hit performance issues. There are also cases that can cause SELECT performance to be impacted in a negative way by adding indexes, but that is usually related to duplicate and/or unused indexes.
But to answer your questions directly:
WHEN - add indexes when you notice SELECT performance is slow and you are out of other options to improve performance
WHAT FIELDS - add fields that are used to filter or order the data
The reason I say "out of other options to improve performance" is because if you have some crazy complex query or you have a poorly written query (uses a cursor for example... which isn't always a poorly written query, but will always give you performance problems), it is often better to fix the bad query than to fix it at the table level. It is EASY to add an index that makes your query faster, but it may be difficult to test all queries that touch that table and your new index MAY make everything else slower.
The above is all just my opinion on what you should do.
As with all advice you find on a random internet forum - you shouldn't blindly follow it. Always test on a test server to see if there is negative side effects before making changes to live!
I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.