That's a loaded question. I'm sure you'll get a few responses filling in the gaps.
In the most simple form, the pheremones from the queen, as well as eggs/larvae/brood, signify the scent of a healthy hive. When the queen is removed her pheremone is removed - telling the bees they don't have a queen. This encourages them to make one, or in most cases, many. The ONLY difference between a worker and a queen is what the larvae was fed. To make a queen from a regular larvae they will load the cell with royal jelly and draw it out larger. Yes, they will take a regular worker cell and build a new queen cell around the larvae. The size of the cell doesn't determine a queen, look at drone brood which is huge.
However, when a hive decided to requeen or swarm (which can be caused my low queen pheremone or crowded hive, where it's harder to smell the pheremone) they will draw out specialized cups, queen cups. These are larger, purpose built cells which point downward. The queen will lay in these cups and the bees will draw it out, just like they would from a worker cell. Replacement queens or swarm queens are often considered superior as they are from these purpose built cells, instead of a modified worker cell. This is why breeders graft young larvae into a premade cup and introduce those larvae to a queenless colony. This queenless colony wants to make a queen so badly they will take to the larvae we added and feed the needed royal jelly. These queen cells are then usually added to a queenright colony a couple days later, separated with an excluder, for a larger colony to finish them off. (due to the large amount of resources it takes to make a queen) These cells can be added to a queenright colony only because bees have a tendency to finish what they start. They started the queens, may as well finish them. However, if the queen in the colony could get to them she'd surely tear them down.
A hive also knows it's queenless incredibly fast. For those of us who have taken all their boxes off a hive, the boxes without the queen will begin to roar with all the bees fanning, looking for the queen pheremone. The box with the queen will not do this.