it is very very complex.
I'll try to give you a few examples.
1. when a statement is wrong.
Let's say you wear a green sweater and someone says: Your sweater isn't green.
In English, you'd say: yes it is! In german, you say: Doch!
Or: you will come with us tonight, but someone asks: you are not coming? In english: yes I do come! (4 words!) In german you simply say: Doch!
2. You believe something truly, you think, the other is wrong.
Der Test war so schwer! You: Der Test war DOCH einfach! (the test was so hard! , No, I think the test was easy)
Ich werde 100 m in 8 Sekunden laufen! you: Das schaffst du DOCH nie!
(I'll run 100 m in 8 seconds. You'll never do it!)
Der Fernseher ist kaputt! You: Der funktioniert doch!
(The Tv is broken! No, it works)
There are other ways we use it, but it is hard to explain by writing it simply down, i'd need 100 words for it!
Hope, I helped a bit. :)