Who should write you a letter

Here is some advice on who to ask to get a strong letter, and expectations from people who will read the letter.

How can I know if Prof. X will write me a strong recommendation letter?

This is a good question. It is a bit awkward on both sides, but I do think it best when asking for a reference letter to say "Do you feel comfortable writing me a good reference letter?". 

For example, for graduate school admissions, is it better to get a recommendation letter from a supervisor who might know you less personally or who has known you for less time than say an advisor who has known you for several years but has never seen you do research,

Unless you know they will write you a bad letter, one of your 2-3 letters must be a letter from a supervisor. Anyone reading your application will find it very odd if the prof who presumably knows you best is not providing a letter for you. 

If you did an industry internship, should you get a recommendation letter from someone you worked with at that company or would it be better to get a letter from a professor, etc.? 

It depends on what the application is for. If it is for an industry job then a letter from someone in a company is great. If it is for a PhD, say, then a letter from someone in industry is typically not of much use (unless that person is actually doing advanced research).