I am glad that you bring up history, it is important here. The land now called Israel has been fought over and occupied by different people over millennia. After the second world war Palestine which was ruled by the Ottomans for most of the prior 500 years, but recently ruled by the British post WW1, was partitioned into a Jewish and Arab sections by the British. The Jewish section became the state of Israel and a home and sanctuary for the persecuted from WW2. Several wars later the Israeli nation has waged war and taken more land from its neighbours and specifically the Arab section of Palestine, more or less doubling the size of the country created. Israel was funded and armed by western nations, most notably America for the reasons that several on here have cited - religion. The occupation of Palestine by Israel created first the Palestine Liberation Organisation and later Hamas.
I assume that you have never been to Israel let alone Palestine, if you had I am sure that you would have a different view. Israel is a wealthy nation where Palestinians are 'allowed' to work but in an environment reminiscent of WW2 Germany (ironically) they need proper papers, are forced to line up each day with no guarantee of work and treated like enslaved labour. In the West Bank the Israeli 'settlers' steal more land from Palestinian farmers with aggressive armed tactics, supported by their government. In the Gaza strip, the border entries are controlled by Israel, other than those with Egypt. Israeli gun ships patrol the seas off the coast of Palestine, shooting at the fishermen if they come more than a mile off their coast - which is technically in the Palestinian territory, well before international waters start. Many vessels are sunk and fishermen killed. The daily life in 'peace' time is one of oppression, subjugation and control.
Israel has been waging an overt and covert war on the Palestinians for decades, persecuting them, controlling them and killing them, all in the name of self defence. It is true that Hamas are linked to and supported by Tehran, is this no surprise that a nation looks to help the Palestinians resist. This is no different to the Americans funding the IRA through Norad in the 1970s or its support for multiple 'rebels' in central and south America who are striving themselves for regime change.
The fact is that the arbitrary partition of Palestine post WW2 to create Israel was bad enough, the American funded expansion and aggression since then has lead to resistance and Hamas. It is Israel and the Americans that created Hamas and in a different world, America would also be funding Hamas to resist the imperialist expansion of an aggressive neighbour and calling Hamas freedom fighters not terrorists.
What happened 2 years ago was awful, but hardly a surprise and hardly proportionate to the decades of theft, killing and aggression that proceeded it. Being aware of the history in this awful situation is important.
What I have shared is fact, not conspiracy, the conspiracy theorists will tell you that Israel knew the attack was coming (perhaps not the level of killing) and allowed it to happen so that they can reference it in an all out assault on Palestine.