Do banks pay for deposit insurance? Under deposit insurance, if my bank goes bankrupt, the government reimburses my deposit up to a specified maximum.

Do banks pay for this insurance, and does it depend on their risk-taking?  If not, what is to stop banks from taking very high risks with deposits from private citizens (the ones unimportant enough to be below the threshold), knowing that the government takes the risk (and will likely opt to rescue the bank rather than repay all account-holders, should the bank fail)?

(Relevant: two main problems with deposit insurance)
There's additional information in this answer, but in the US, banks pay into the FDIC Deposit Insurance Fund, and regulation and capital requirements are used to stop banks from taking excessive risks with deposits. In the event of a bank failure, depositors below the insured limit are repaid in full, but equity-holders are generally wiped out and other creditors must often take losses as well. 

The DIF premiums do vary somewhat with risk (see page 2 here):


  The FDIC charges premiums based upon
  the risk that the insured bank poses, and it inspects, or examines, banks to further manage that
  risk.