What is the proper procedure for leaving class D airspace?
The AIM covers this from an operations / legal standpoint:


  3-2-5. Class D Airspace
  
  
    4. Departures from:
    
    
      (a) A primary or satellite airport with an operating control tower. Two‐way radio communications must be established and maintained with the control tower, and thereafter as instructed by ATC while operating in the Class D airspace. [emphasis mine]
    
  


While operating in Class D airspace, you must maintain two-way radio contact with the tower – monitor the frequency and be prepared to respond. 

You may leave the frequency once you are either clear of the airspace, or receive instructions to that end from ATC ("N1234, frequency change approved").

Whether or not controllers are bothered by you letting them know that you've left, I can't say, but it would probably qualify as frequency congestion. If they want to get in touch with you, they'll try ("N1234, are you still with me?"), but once you're outside the Class D airspace they're generally only providing advisory information.