Electrical problem

last night I was working on my car and I turned the stereo on and it came on with no sound....I thought maybe the stereo was fried so I swapped it for another.....same thing lights are on no sound . I then tested the old stereo directly on the battery with one of the speakers it worked fine . Thinking its an electrical problem I tried to roll the starter over.....no luck , the relay is clicking and I have power at the starter . It is a brand new starter ...so I try it right off the battery it works . Now I try other stuff....line loc solenoid no longer engages unless the key is in the starting position.....I turn the fan on and the power to the stereo goes off . ONE A.M GO TO BED

I obviously have done something wrong any hints on where to start.