The issue is actually a bit more complex.
Batteries have a particular rating, let's say 2500mAh for a very good 1.5v AA alkaline battery (AAA are usually around 800-1000mAh). However, as the battery discharges, so does the voltage decrease - a new battery will show about 1.65v and the battery voltage will slowly go down up to as little as 0.8v-1v.
For example, let's have a look at this Energizer alkaline battery (just one of the first Google results, not chosen for any reason):
http://data.energizer.com/PDFs/E91.pdfOn the first page, you have on the right a chart, which shows you the capacity depending on how much current the device connected to the battery takes out continuously. Notice that at 25mA the capacity is 2500mAh but also pay attention to the note above saying
discharge to 0.8v ... not all devices will continue to run at such low battery voltages.
If you go on page 2, you see on the right another graph where you have on the x axis the current consumption of your device and on the y axis, you have the number of hours. Assuming your device can run with any voltage between 1.2v and maximum voltage of the battery and uses 20mA all the time no matter the voltage, then the battery will power your device for 100 hours ( you look where the line for 100 and line for 20 cross the blue line for 1.2v.
A keyboard can last quite a lot of time because as soon as you stop pressing keys, the brains inside the keyboard puts everything to sleep, where the keyboard uses microamps (uA) or even less current. Even when sending keys to PC, it may use a few mA but only for a few seconds and then goes back to sleep.
So first of all, you have to determine how much current your product uses within a certain period of time - a good logging multimeter is very good for that.
Then, you have to figure out what's the lowest voltage your product will run at... for example, a microcontroller may work with as little as 1.8v (which would mean as little as 0.9v for each battery if you have the batteries in series) but your bluetooth may stop working at around 2.5v (I'm just saying it as an example, I don't know the actual minimum voltage).
Equipped with this information, you can look at various batteries and estimate how much your product will use.
Programming your device to go to sleep when unused, or to reduce the microcontroller frequency if there's no need to run so fast, turning off the bluetooth when it's not needed, all these can improve the battery life.
Other thing you have to keep in mind.. if your microcontroller or bluetooth (or both) absolutely need at least 3v or a voltage that would mean you'd be left with a lot of energy unused in the batteries, you may want to have a look at boost or SEPIC dc-dc regulators. There are regulators which can work with as low as 0.7v and boost this voltage to the higher voltage your product needs. A SEPIC regulator works both ways, it can take lower or higher voltage and output a voltage in between.
If you use something like this, the battery life is harder to measure, because of this regulator's efficiency in converting energy.
For example, let's say your product uses 20mA and needs 2.5v to run (so 2.5v x 0.02A = 0.05w) and you use 2 AA batteries (so 1.65v x 2 = 3.3v initially).
With a SEPIC converter, until the battery voltage goes down to 2.5v (so 1.25v per battery), the regulator will produce that 2.5v with about 90-95% efficiency. At 3v for example, it will draw about 0.0505w / 3v = 0.01683A (16.83mA) from battery.
When battery goes down below 2.5v, the regulator will have to boost the voltage to 2.5v... at 2v (so 1v per battery), the regulator will have about 80-85% efficiency so it will draw 0.0575w / 2 = 0.02875 or about 28.75mA
So you can see that while your product will always get 2.5v and use 20mA, with a SEPIC regulator the current drawn is less than 20mA while battery voltage is more than 2.5v and after that the regulator will pull more current from batteries in order to maintain that 2.5v, which means the battery discharge rate will gradually increase (important to know when designing a "battery level" indicator for example)