first off, if your a guy then cut it all off.

if your a girl then your going to just have to brush it out. hold your hair above the tangle with one hand, and brush with the other so that your not pulling your scalp with every brush. once the tangles are out get it shaped up then use a nice conditioner and shampoo meant for frizzy hair every day. it looks like uve just let it go too long without maintainence.