Did the Israelis know that the six-day war was going to happen?

The Israelis knew that a war with Egypt and Syria was certainly imminent. The fact that the war started on June 5, 1967 as opposed to sometime in September or October was Israel's choice since they struck pre-emptively.

In terms of why the Israelis knew the war was imminent:

1) "Wipe Israel off the Map" Statements: Arab Nationalists, especially Charismatic Egyptian President Gamal Abdel Nasser of Egypt, were pushing strongly for Israel's elimination and made daily speeches about how the Arab States were going to invade and remove Israel from the map to form a unified Arab State. He began to coordinate military strategy with Syria and Jordan (to a lesser degree) as to how to invade Israel effectively. These threats were made daily and consistently in 1967. Additional troops were added to the Egyptian Army and that army began to be arrayed closer and closer to the Israeli border.

2) Removal of UNEF Forces: As a condition of the Israeli withdrawal from the Sinai Peninsula in 1956, the UN deployed security forces to the Sinai Peninsula to prevent Egypt from massing troops in the Sinai. Nasser evicted the UNEF (the UN security force) from the Sinai Peninsula in contravention of the Armistice for the 1956 Suez Crisis and placed large numbers of Egyptian soldiers and armored divisions on the Israeli-Egyptian border.

3) Arab Military Coordination: Nasser coordinated military strategy quite closely with Syria and Jordan. It was clear to many at the time that these forces would not sit idle for long. A number of Syrian battalions were positioning themselves in the Golan Heights above the Sea of Galilee and Jordanian positions in the West Bank were becoming more entrenched.

4) Closure of Waterways: Egypt, counter to the armistice ending the 1956 War, closed the Suez Canal to Israeli shipping and then proceeded to close the Straits of Tiran to Israeli shipping, cutting Israel off from trade with Iran which was Israel's greatest ally in the Middle East at the time and primary supplier of petroleum. This had the effect of strangling Israel and is considered by Israel to be the primary causus belli.