God reassures Abraham that it’s okay to dismiss Hagar and Ishmael for a couple reasons: Abraham’s offspring will be reckoned through Isaac, and Ishmael will get his own nation (Gen. 21:12-13). Thus ended the drama of how God would hold to his end of the covenant. To a father as old as Abraham this news was, no doubt a relief. Isaac would grow old enough to produce grandchildren.
God will be god though, and later demands that Abraham sacrifice his miracle child and heir, Isaac (Gen. 22:2). What could have possibly been going through Abraham’s head at the time? Depending on how you interpret the terms of the covenant maybe a couple things. If the covenant is limited to God makes Abraham a nation as long as he maintains the ritual of circumcision (Gen. 17:10), Abraham was probably thinking that God was not holding up his end of the covenant, but was too dangerous to defy (e.g. Eden, the Flood, Sodom and Gomorrah, Lot’s salty wife, and Abimelek). If the covenant requires Abraham to undergo circumcision and obey God unconditionally (Gen. 17:1-2), Abraham must have felt stuck in a Catch-22. He must obey God and sacrifice his heir in order to up hold the covenant so that God would make Isaac into a great nation.
What does this tell us about God? At the very least it shows that he’s just as willing as Abraham to use deception to get what he wants. In this case the deception was requiring Isaac’s sacrifice, but then stopping Abraham at the last moment so that Abraham would, presumably, prove to himself that he has absolute faith in God and that God would come through on the covenant, even against God himself.