There is a history to why it came about. As an alternative to spinning the arrows head to determine action.
When and why? When it is a major decision and you don't know the ending. Would it be good or would it be bad, for you?
Istikharah means you allow Allah to plot your ending.
Once given the signs, you must have faith, you may still go through trial and tribulations but KNOW that the ending will be great, and remember to be thankful then :shade: