Normally, dynamic abbrev expansion ignores case when searching for expansions. That is, the expansion need not agree in case with the word you are expanding.
This feature is controlled by the variable dabbrev-case-fold-search. If it is t, case is ignored in this search; if nil, the word and the expansion must match in case. If the value of dabbrev-case-fold-search is case-fold-search, which is true by default, then the variable case-fold-search controls whether to ignore case while searching for expansions.
Normally, dynamic abbrev expansion preserves the case pattern of the abbrev you have typed, by converting the expansion to that case pattern.
The variable dabbrev-case-replace controls whether to preserve the case pattern of the abbrev. If it is t, the abbrev's case pattern is preserved in most cases; if nil, the expansion is always copied verbatim. If the value of dabbrev-case-replace is case-replace, which is true by default, then the variable case-replace controls whether to copy the expansion verbatim.
However, if the expansion contains a complex mixed case pattern, and the abbrev matches this pattern as far as it goes, then the expansion is always copied verbatim, regardless of those variables. Thus, for example, if the buffer contains variableWithSillyCasePattern, and you type v a M-/, it copies the expansion verbatim including its case pattern.
The variable dabbrev-abbrev-char-regexp, if non-nil, controls which characters are considered part of a word, for dynamic expansion purposes. The regular expression must match just one character, never two or more. The same regular expression also determines which characters are part of an expansion. The value nil has a special meaning: abbreviations are made of word characters, but expansions are made of word and symbol characters.
In shell scripts and makefiles, a variable name is sometimes prefixed with $ and sometimes not. Major modes for this kind of text can customize dynamic abbreviation to handle optional prefixes by setting the variable dabbrev-abbrev-skip-leading-regexp. Its value should be a regular expression that matches the optional prefix that dynamic abbreviation should ignore.