It's located in the Objects/dictobject.c
file. There is a dictnotes.txt
file there too, to guide you in understanding the source.
Python dictionaries use a hashtable with open addressing to map keys to slots. Conflicts are resolved by 'perturbing' the key; an algorithm that'll start with a large step, then use smaller and smaller steps until it scans the table for the next empty slot.
There are several articles on the web, including this blog post; you can also pick up the book Beautiful Code for an excellent exposure of the code.