Understanding how dogs think and what shapes their behavior is the first and most important step in communicating with your dog, for that is what dog training is all about.... Communication.
Dogs are actually very simple creatures. They will continue to repeat behaviors that get them what they want (behaviors that are reinforced), and extinguish behaviors that don't work for them. If we, their trainers, remember this we should be able to understand why they act the way they do.
First off understand that humans are not the only avenue dogs seek reinforcement from. It exists for them in the environment and they will happily partake in it if we allow them to. Canine Behaviorists call these 'self-rewarding' behaviors. The more we can see the bigger picture the easier it is to understand why our dogs are doing what they are doing. We can then get creative and come up with ways to change their environment so that they look to us for most of their reinforcement.
Pulling on a leash is an example of a 'self-rewarding' behavior. First off, dogs do not mind pulling. They actually like it. It does not cause them the discomfort that we would think it does. The reason they keep doing it is that we have trained them to see that it works for them. Take the example of a male dog that likes to mark every tree on a walk. (Yes, dogs enjoy marking. This is an example of 'self-rewarding'.) If you, as the owner are pulled over to every tree or post so the dog can lift his leg, he has been rewarded for pulling.
Dogs enjoy chasing squirrels. If you let your dog off leash and he starts chasing a squirrel and you continue to call him, he has actually been rewarded for not coming when called. Even if you reprimand him harshly for not coming. The fun of chasing the squirrel may be worth the punishment. This is why harsh training can be very ineffective.
Barking in a crate is a very annoying behavior. First off, understand that dogs do not mind barking. They have to bark long and hard for them to tire of it. If a dog barks in his crate, and you let him out, you have just reinforced barking in the crate. The next time he will bark longer and louder to get what he wants.
So, how do we deal with this? In the case of pulling to a tree, allow your dog to potty before the walk and take him to a tree and have it be YOUR idea. Praise him for relieving himself. Then continue on the walk and be ready to tell him to heel before he gets to every tree BEFORE he has started to pull. You may have to leash correct. When he stays with you as you pass a tree, praise him for it.
Never allow your dog off leash, or off a long line, until he has been proofed against distractions. Use the squirrels as a distraction and reel him in if he does not come. When he willingly turns away from the squirrels this is a behavior that can be reinforced by you.
As for barking in a crate, it's simple. Never let him out when he is barking. If you think he may need to potty, take him out, let him go, and put him back in. Tell him to be quiet. Perhaps cover the crate. When he quiets down for a few moments, that would be the time to let him out. He will get the idea that calm, quiet behavior gets him his freedom.
These are just three common behaviors that dog display that make frustrate us. The list could go on and on. Even up to and including aggressive behaviors in which dogs begin to run the house. Of course that always ends badly for the dog. But, the good news is it rarely has to be that way. And while it is true, that the longer a behavior has existed the harder it will be to extinguish, it can be done. You can start today to create solutions by controlling the environment to shape better behavior.