Two separate systems within a key and the cut blade.
The battery inside the key is only used for the central locking and powers the buttons functions on the small pcb inside the fob, it talks to the aerial located inside the rear view mirror and that via the cars electronics speaks to the EWS module that controls release of the starter motor, if the key used matches the code inside the EWS it allows the car to start. The code in the key fob transponder is changed every time the key is used in the ignition, known as a rolling code, the transponder is a small rectangle shaped chip, it has no power connection it just sits there in the fob and is read by the aerial that is around the ignition key barrel/lock. It is this transponder that has to be programmed to the car using software and a laptop computer. A mobile locksmith can do this at a price or you could try doing it yourself using an AK90 key coding machine available on ebay. The cars EWS module has to be removed from the car and its chip has to be read in order to code a new key. I tried doing it with an AK90 machine but couldn't get a cranking key. In the end I had my already cut key programmed by a locksmith using his expensive coding machine, he had to read the module via its eeprom chip and coded the key to an already used key slot in the module, it was a slot that I hadn't got a key for. You can always buy a dumb key from BMW dealer, it will not have the central locking functions just the cut blade for your car and allow the car to start as it is programmed from the factory using data they hold for your cars build. I think the dumb key costs under £100.