What make, model and year do you have? Did you buy it used? Has it had questionable gas put in it? Is it throwing a code or not? Was it run in an urban environment, more short trips that long highway ones?
I had the same problem, with an 07 530 with the standard 6 cylinder engine, 62K miles. Ugly idle +- 100 rpm, no codes. Not much reason to take long trips.
Assuming no codes thrown, start with the simple stuff. If you bought it used (former owner perhaps using crappy gas), or if you had to get gas in an iffy location, or you just used in around town, get three bottles of Techron, and add one to your next three tanks of high quality premium.
Second, take it out on the highway and run it to 5K+ rpm by downshifting to a lower gear. Leave it that way for 10 minutes. The car is fine at that RPM for hours, but this'll clear out some of the accumulated crap that collects throughout.
These two items helped me a lot, clearing up most of the iffy idle. I was considering the Idle Control Valve, but the problem cleared up most of the way with the above.
2003 325XI (gone)
2004 530I (gone)
2001 530I (gone)
BMW CCA Member 10+ Years
Oft have I digg'd up dead men from their graves,
And set them upright at their dear friends' doors,
Even when their sorrows almost were forgot;
And on their skins, as on the bark of trees,
Have with my knife carved in Roman letters,
'Let not your sorrow die, though I am dead.'
Titus Andronicus, Shakespeare (Happy Halloween...)