These are good questions and I hope someone with more knowledge then me answers them more thoroughly. In short my answers are:

How did Hamas come to power? Via democratic elections and by winning a subsequent civil war.

What are their goals? Total Palestinian liberation and the restoration of the pre 1948 borders (a.k.a one state solution).

How do they promise to achieve these goals? Via armed struggle, a.k.a. intifada and revolution.

Hamas came into power after a fair democratic election in 2006. Outside observers monitored the elections and all agreed they were correct and fair. The only major interference actually came from Israel which backed the rival political group Fatah. Following the election the Palestinian civil war broke out in Gaza, which Hamas won. After which they took full control of the Gaza strip. There has not been an election since then, neither on Gaza nor on the West Bank. Aside: The legislative council in Gaza was demolished by the Israeli army last November.

Meanwhile on the West Bank Fatah took power, where they control the Palestinian Authority. It is interesting to see the fate of the territory each faction controls. While Gaza suffers a blockade and constant military interventions, the West Bank is suffering from constant incursion from settlers and military raids as well as further partitioning of their lands, illegal settlements, military checkpoints, etc.

In simple terms, Fatah supports the two state solution, among with most of the international community, which is why many Western nations view them as the legitimate government despite Hamas having won the election fair and square. Hamas on the other hand at first did not recognize Israel as a state, and wanted all of historic Palestine under Palestinian control. Since 2006 they have somewhat eased their stance against Israel, but are still calling for decolonization and one state.

The Palestinian Authority (and Fatah by extension) is not popular among Palestinians. The way I understand it is that people view them as a colonial government, pandering to the interest of their colonizers. It is my understanding that Hamas is viewed favorably, as pandering to the interests of the colonizers has not left the West Bank in a nice state for the indigenous population.

In short, in simple terms (as per my limited understanding), the two state solution is not seen as the right path inside Palestine, so people actually support Hamas’ one state solution, and see the fight for decolonization as legitimate. This may be a tough reality for westerners to accept as Hamas is only portrait by their very real and devastating atrocities, but seldomly seen as liberation fighters and never recognized for their decolonization efforts.

Instead of relying on western analysis of the situation, I actually like to take in some historic comparisons. The Mau Mau in Kenya were indeed very brutal, and conducted very severe crimes against, however their fight—with the hindsight of history—was indeed very just, and resulted in the liberation of Kenya from the oppressive British colonial rule. Another example is FLN in Algeria, which probably had even more popular support then the Mau Mau, and were even more brutal in their fight against their French colonial oppressors.