It works in the second example where you're talking about named subgroups. It doesn't work well in the first example where you are simply talking about different beliefs or customs that people within that cultural group have. "People who don't believe in god" could come from any cultural or ethnic background.
Your first example is problematic for a number of reasons. First "people who believe in god" and "people who don't believe in god" would generally be considered too culturally and ethnically diverse to form a people. We don't usually call people who simply share opinions or characteristics a "people." Peoples usually need to have names of some kind.
Second, although we normally wouldn't think of the set of all people who don't believe in god as a "people," even if you tried to, this set only intersects with the set of Hindu people, it is not a subset. Thus, you can't describe the don't-believe-in-god people as a "type of Hindu people." So to express the idea in your first sentence, you would want to use the plural version of "people:" Some Hindu people believe in god and some don't.
However, it does work to use "peoples" in your second sentence, there's one set that is the Hindu people, with two subsets: the Shakta and Shaiva peoples.
However, you do want to refer to the people and not the branch of Hinduism. I'm not positive I have the right words with Shakta and Shaiva, but you wouldn't say "two types of Hindu peoples, Shaktism and Shivaism." You need to use the words used to refer to people who practice those branches. (For example, you didn't say "Hinduism people.")
Perhaps it would help to show it as a type of math:
1 Shakta people (ethnic group)
+ 1 Shaiva people (ethnic group)
________________________________
= 2 Hindu peoples (two ethnic groups that are both Hindu)
n Hindu people who believe in god
+ n Hindu people who don't believe in god
_________________________________________
= n Hindu people (many Hindu people with different beliefs)
Conceptually, however, the second example could also be this:
n Hindu people who believe in god
+ n Hindu people who don't believe in god
_________________________________________
= 1 Hindu people (one Hindu people [cultural group] made up of many people)
Also, because it seems like your confusion has something to do with the fact that the Hindu people is also a cultural group, bear in mind that it is still only one cultural group (one set with subsets). So:
1 Hindu people
+ 1 Bengali Muslim people
______________________________
= 2 Indian peoples
Finally, just because I think set theory is really useful for understanding this:
- Each individual member in these sets is a person.
- Multiple set members are people.
- The name for each individual set is also people.
- Multiple sets are peoples.