^Trust me, I'm just learning about this group as well, and it is hard to take in. XD
From what I can gather, The Senbatsu are the main girls who are featured in the main song and PV of the single. Undergirls is basically just the rest of AKB48 that doesn't get featured in the main song on singles so they get their own song and PV. Naturally, the most popular girls usually are in the Senbatsu but there's no set line-up and girls can get promoted or demoted based on their popularity. I'm still not sure what Theater girls are though, I think they're probably the least least popular members, lol.
Feel free to correct me, someone.