According to http://en.wikipedia.org/wiki/Dinosaur, Dinosaurs were the dominant terrestrial vertebrates for 135 million years. They had a lot of time to evolve. My question is: why were dinosaurs not smarter than us, and why was their society not complex like ours is?
Your question should not be specific to intelligence
You can think of any other phenotypic trait (wings, toxins in the skin, good eyes, good smell, strong leaves, etc...) and ask this same question. You seem to assume that being smart should be some kind of goal or necessary direction toward which species should evolve. Following your reasoning I would rather ask why the hagfishes, the oyster, the lampreys or the turtles are so dumb although they exist for so long (way more time than dinosaures have never existed).
Benefit and cost
Morover most of these trait have associated cost to the benefice they might bring. For example having a big brain asks for much energy (20% of ATP in humans) and it also has a cost due to its weight. The sperm whale for example has a brain that weights 7.8 kg. Obviously it is not a big cost for such a big animal to carry heavy organs while it would be impossible for a migratory bird to carry such a brain.
taking different evolutionnary path This part is probably not complete!
Now the question of why Homo sapiens are smart while tyranosaurus rex are not or why wings evolved in bat and not in mice is rather interesting and hard to answer. I can think of 2 main causes:
1) The newly arising trait (which is usually not the trait you can observe today. Big brain did not appear suddenly, first there were individuals they had slightly bigger brains than the other individuals in the population) is not beneficial over the wildtype trait. There are so many parameters that will affect if a trait is beneficial or not. You can think of the predators, the humidity in the environnement, the social structure, the population size, the type of reproduction, the genetic background etc...
For example, think of a species that is fixed, has no social contact, has nothing it can really predict in the environnement. What would an individual from this species do with a brain? Think of a bird that needs to make food stock for the winter. This bird needs to remember where it hide something. It has been found by the way that some birds have an awesome spatial memory, way better than humans.
2) The trait never happen to occur (or never in a strong enough individual, or never in a population big enough to not suffer from to much drift while the trait is at low frequency) just because the necessary mutation never happen. Mutation is just a random process.
For example. It seems rather hard for a tree to have the necessary mutations to have develop a brain! But we don't need to go to such a extreme example. If you split a population of clone mice in two, the two subpopulation will evolve differently (even in absence of genetic drift (infinite population size)) just because some mutations occur on one side while some others occur on the other side. Or maybe the same mutation might occur but once in an individual that has low fitness and once in a very fit individual.
Evolution of human cognition abilities
So what are the factors that drive humans to evolve big brains? This question is not solved yet. We have many models to explain this but I don't we have much solutions to test these models. The 2 most common models explain big brains
For more information concerning the evolution of human cognition, this wikipedia article might be a good start.
Our genetic data are encoded into a succession of 4 types of nucleotide bases (A,T,C and G). A mutation results from a modification of this sequence such as a replacement of a T by a C. These mutations are due to mistakes usually while duplicating the DNA. Most of these mistakes do not affect the fitness (survival + reproduction ability) of the individual, very often these mutation are deleterious and rarely these mutations are beneficial. Some mutations are more probable than others but nevertheless some individuals have a higher mutation rate than others. In order to make things slightly more complicated, some sequences have a higher mutation rate than others. For example, the sequence