What seforim discuss how psak is formulated and the history behind it? The history of the Mechaber and later achronim as well as the origin of machlokes which, in a way, started an idea of mediating between opinions.
There is a book called The Making of a Halachic Decision, by Rabbi Moshe Walter. It is divided into three sections - Klalei Hapsak, The Halachos of Hora’ah, and Klalei Haposkim. It goes through a lot of historical background of the development of the halachic process.