I believe I understand the meaning of the expression чёрта с два
[черта с два] = [not to get what you want] + [how dare you?]
Why is чёрта in the accusative/genitive case?
Because [черта с два] is just a first part of the full phrase which is [черта с два ты получишь, а не то, что хочешь]
For example,
- Can I have some beer?
- [черта с два ты получишь, а не пиво].
- [черта с два] you will get, but not some beer.
Real version:
- Can I have some beer?
- [Черта с два!]
In this case it is not just: No!
It is: [no!] + [How dare you just think of idea to have any beer?!]
So, it is not just [черт с два] which anyone can put in any case form as usual noun [черт].
It is so called fixed phrase.
That's why it is always genetive in combination with [с два].
Why is [два] in the nominative case after [с]?
Because of usage [с] + [number] when you mean [around].
[с два] = [примерно два] = [около двух] = [что-то типа двух] = [around 2] = [2 or something] = [~2]
[черта с два] = [два чёрта или около того] = [примерно два чёрта]
What are the "two" mentioned in the expression?
That is sarkasm.
Direct saying what you mean:
- Can I have a beer.
- No, you can't.
Sarkasm way of saying the same meaning as above:
- Can I have a beer.
- Yeah, sure! You even can have 2 beers, you bastard.
[черта с два] is kinda old phrase about 200-300 y.o. at least.
But nowadays we have the same contemporary construction for this case.
Contemporary sarkasm way of saying the same meaning as above:
- Can I have a beer.
- Yeah, sure! You even can have 2 beers and one in the middle, you bastard.
The deep meaning of this sarkasm is to show the person in indirect way that idea itself of having what he wants is rediulos and silly. How dare you even think about it?!
Summary
- Can I have a beer?
- Instead of having a beer you will get a demon... no! — 2 demons or even more.
which short form is
- Can I have a beer?
- You'll get 2 demons or something.
and finally
- Can I have a beer?
- 2 damns or something.
I guess English word [damn] is just a shrinked [daemon], that why [2 черта] = [2 damns]
[Damn] in contemporary English means [curse].
Therefore
- Can I have a beer?
- Curse on you! Twise or so!!
PS. I'm new to SE and do not know what to do, but there is Duplicate of this quesiton 1 year ago
accusative/genitive case
— it's actually neither of them, it'spartitive
(doesn't exist in "official bookish" russian, but can be seen in some folk sayings).