A CS2 case key is the consumable you need to open a case. Each case has its own key, and you buy keys directly from Valve in the game store at a fixed price per key. The case itself may cost a few cents on the market, so the key is usually the larger part of what an opening costs.
Keys bought since a 2019 change are locked to the buyer. They cannot be traded, put on the Steam Community Market or moved to another account. Keys bought before that change stayed tradable and now sell at a premium as collectibles or as a way to move value between accounts.
Why did Valve stop key trading?
Valve said that most key trades had become a way to move money for fraud rather than a way for players to open cases. Locking new keys to the buyer stopped keys being used as a currency between accounts. It also meant that anyone who wants to open a case has to pay Valve for the key.
Old tradable keys still exist in small numbers and sometimes trade well above the store price. Buying one to open a case makes no sense, since a new key from the store is cheaper for the same result.
How does the key price affect case opening value?
When you work out whether a case is worth opening, add the key to the case price and compare the total to the average value of the drops. For almost every case that total is higher than the expected value, which is the house edge of case opening. A cheap case is not a cheap opening if the key still costs the same.
Third-party case opening sites do not use Valve keys at all. They sell their own openings for site balance, so the term key means nothing there, and their odds and pricing are set by the site, not by Valve.