In a nutshell
A hash table finds things almost instantly by computing where they live instead of searching. A hash function turns each key into a bucket number, so to store or look up a key you jump straight to that bucket. Sometimes two keys land in the same bucket — a collision — and those are kept together in a small chain. As long as collisions stay rare, lookups are effectively constant time, which is why hash tables back dictionaries and sets everywhere.