Ahhh, the old "rough idle"!
Possible causes are as said above - dirty injectors or dirty fuel. Other possible culprits are poor airflow caused by either dirty filter, mal-adjusted airflow meter, or maladjusted mixture screw (all usually easy and cheap fixes).
It could also be poorly adjusted tappets as they are adjustable on the 6-cyl. This often happens after someon has tryed to eliminate rattling caused by worn tappets which is a very common problem with these cars. If this is the case, get them adjusted back and live with the noise - it is very rarely a major problem.
It could be a problem with the ECU, but hens teeth are more common than this.
It could be an issue with the ignition system esp. if it "misses" under acceleration as well.
So my advice is to do the usual maintenance that you should always do when buying a new used car:
Change the air and fuel filters, change the oil and oil filter, change the coolant, change the plugs, and then if you want to get it tuned. Also, with a car of this mileage I would definately get the timing/cam belt replaced ASAP and make sure they replace the belt idler/tensioner as well as these parts are not that expensive, but if they fail will probably destroy your engine. All of this is relatively inexpensive, but as I am not from the US, I have no idea what this would cost you there. Less than NZ$1000 including labour for all of the above here.
If that does not fix the prob, then it is a job for a BMW service agent, or a qualified mechanic. I have spent heaps trying to iron out rough idling and flat spots on my car, and have only just got it right, I am a perfectionist however and am very particular - most of my friends couldn't even hear/see/feel what I was on about. So, if it is at a level you are happy with - leave it.