It doesn't matter if you are 20, 40, 60 or 80 years old, knowing when you need the money can tell you how to invest it to get the best return.