How do we get this expression?

Well, in water solution, the following equilibrium takes place:

#2H_2O(l) rightleftharpoonsH_3O^+ + HO^-#

AS with any equilibrium, we can write the equilibrium expression:

#K_w# #=# #[H_3O^+][HO^-]#

Now #K_w# has been extensively and carefully measured under a variety of circumstances. At #298# #K#,

#K_w# #=# #[H_3O^+][HO^-]# #=# #10^(-14)#.

As with any equation, we can divide it, multiply it, etc. PROVIDED that we do it to both the left hand side and right hand side of the equation. We can take #log_10# of BOTH sides to give:

#log_10K_w# #=# #log_(10)10^(-14)# #=# #log_10[H_3O^+] + log[HO^-]#

But #log_(10)10^(-14)# #=# #-14# BY DEFINITION of the logarithmic function. #(i.e. log_(b)b^(c)=c)#

Thus #-14# #=# #log_10[H_3O^+] + log_(10)[HO^-]#

OR

#+14# #=# #-log_10[H_3O^+] - log_(10)[HO^-]#

And again by DEFINITION, #-log_10[H_3O^+]=pH#, and likewise, #-log_10[HO^-]=pOH#

And thus, #pH+pOH=14#

So in most cases, given an actual #HO^-# concentration we can get both #pH# and #pOH# very rapidly and straightforwardly.

So you must remember #pH+pOH=14#

Note that this relation is valid under standard conditions, aqueous solution, #1# #atm# pressure, and #298*K#. Under non-standard conditions, say at #398*K#, how would expect #pH# to evolve? Remember that the acid base dissociation is a BOND BREAKING reaction.