It can be very difficult. My oldest is now 21 and when he went through all this, ( I think he was quite late, we hit the really bad times when he was doing his GCSEs, so 15 ish), I don't think I dealt with it particularly well. I fell out with him frequently. They go from happy outgoing kids into fairly withdrawn and silent, grunting only when spoken to and it can be quite infuriating. The only thing that let him off the hook slightly was the fact that his two sisters at 14 and 12 were doing the girl version at the same time (That was equally horrible).
They've all come out the other end, and so have we though, so thats a bonus
Now my youngest who has just turned 14 is the same, but we are kind of laughing it off now, and letting him be. If he wants to go and sit in his bedroom, we let him, then usually after a while he gets bored and comes down for some chat.
It's a learning curve though, and they are all different.