Looks like no activity on this one, so here is the answer:
To avoid losing (and almost certainly winning, since the chance of a tie is very small as long as there are a sizable number of coins, of multiple denomination):
1) Number the coins left to right (or vice-versa, with appropriate changes)
2) Determine the sums of the even numbered coins and the odd numbered coins
3) Choose all the even or odd coins, whichever is larger.
And you don't even need to keep up with which coins were even and which were odd. Let's say that the total of the even numbered coins was larger
Pick the far right coin (number 40)
Your opponent is left with a choice of two odd-numbered coins.
Whichever end your opponent chooses, he will "uncover" an even numbered coin. Continue this way, always picking from the same end of the row of coins that your opponent chose from, and you will end up with all the even numbered coins, and thus win.
Maximizing your winnings is a computer algorithms problem in something referred to as dynamic programming. Here's a link to begin to understand that if you so desire: