Counter works when the opponent hits you with a physical move only then it will affect the foe.After you are hit with a physical move it would counter just as the name says but will also double it . It normally is a good move if you know how to use it but not very helpful in competitive battling .
It will work in this way now ther is a battle going between:
a sawk
And a Riolu
and the sawk uses brick break if it did 100 damage then when riolu would counter it it would do 200 damage if we say it in the game's language then it will be some what like this
>The foe's Sawk used Brick Break!
Riolu used Counter!
Ta Da it will use counter some other moves such as revenge work in the same way .