why do you assume that the only reason for a person to attend church if they don't believe in the divinity of christ is political ambition?
On a regular basis for decades? Sure, there are some people (even in this island where the social pressure to go to church is dead even though religious sentiment certainly isn't) who don't believe but do so anyway for entirely sincere cultural reasons, but Obama doesn't seem like that sort of person. And they tend to be quite open about things.
his openness to discuss his own personal religious feelings (or lack thereof) could easily be political expedience. If he were to say he wasn't sure if there were a God, he'd be villified for it.
I'm an officer in my congregation, but I consider myself an agnostic. I don't know how "regularly" Obama attended Church over the years, but being a family man, he wants to raise his daughters to be aware of a religion and to feel they belong to something. It's part of one's identity in many cases. Plus, it's quite possible Michelle Obama is a "believer" and Barack goes along with her (that's pretty common). Not to mention that people who don't necessarily believe everything they hear in church, may find some solace and support there they can't really get elsewhere.