Simply put, no one wants to let go of their money until the last minute :-)
As a freelancer, I find it harder to get paid when the invoice is to a bigger corporation. When it's a contract between me and a start-up it becomes swifter, provided I make sure in my contract that they have short amount of time to pay the invoice. Bigger corporations have more options with what to do with their funds. The more they keep funds in their bank accounts, the bigger their investment. Straight forward.
To tackle the problem, I would revise your contract to state exactly when you are to get paid. Get paid in chunks. When the first chunk is not paid, do not continue the work since you have no guarantee that the rest of your chunks will get paid. Communicate this to your client. The contract is the most important thing for establishing expectations. People will only give you what you want when you outline to them exactly what you want in order for you to work with them. Otherwise, they have no idea how much slack you're willing to give them and will test you by missing deadlines.
Hope that helps. Good luck.