Why is dependence a problem? I'm interested in why dependent observations are a problem in statistics. Let's say you want to know if there is a difference in mean exam scores between two schools. You collect 50 observations in each school. These 50 observations are derived from 5 different classrooms in each school and there is dependence within classrooms. In this instance, how would the results of the t-test be affected and how might they lead to inaccurate conclusions?
 A: The p-value for the t-test is computed under the assumption that all observations are independent. Computing probabilities (such as the p-value) is much more difficult when you're dealing with dependent variables, and it is not always easy to see mathematically where things go wrong with the test in the presence of dependence. We can however easily illustrate the problem with a simulation.
Consider for instance the case where there are 5 classrooms in each of the two schools, with 10 students in each classroom. Under the assumption of normality, the p-value of the test should be uniformly distributed on the interval $(0,1)$ if there is no difference in mean test scores between all the classrooms. That is, if we performed  a lot of studies like this and plotted a histogram of all the p-values, it should resemble the box-shaped uniform distribution.
However, if there is somewithin-classroom correlation between students' results, the p-values no longer behave as they should. A positive correlation (as one might expect here) will often lead to p-values that are too small, so that the null hypothesis will be rejected too often when it in fact is true. An R simulation illustrating this can be found below. 1000 studies of two schools are simulated for different within-classroom correlations. The p-values of the correpsonding t-test are shown in the histograms in the figure. They are uniformly distributed when there is no correlation, but not otherwise. In the simulation, it is assumed that there are no mean differences between classrooms, and that all classrooms have the same within-classroom correlation.
The consequence of this phenomenon is that the type I error rate of the t-test will be way off if there are within-classroom correlations present. As an example, a t-test at the 5 % level is in fact approximately at the 25 % level if the within-classroom correlation is 0.1! In other words, the risk of falsely rejecting the null hypothesis increases dramatically when the observations are dependent.


Note that the axes differ somewhat between the histograms.
R code:
library(MASS) 
B1<-1000

par(mfrow=c(3,2))

for(correlation in c(0,0.1,0.25,0.5,0.75,0.95))
{
# Create correlation/covariance matrix and mean vector
Sigma<-matrix(correlation,10,10)
diag(Sigma)<-1
mu<-rep(5,10)

# Simulate B1 studies of two schools A and B
p.value<-rep(NA,B1)
for(i in 1:B1)
{
    # Generate observations of 50 students from school A
    A<-as.vector(mvrnorm(n=5,mu=mu,Sigma=Sigma))

    # Generate observations of 50 students from school B
    B<-as.vector(mvrnorm(n=5,mu=mu,Sigma=Sigma))

    p.value[i]<-t.test(A,B)$p.value
}

# Plot histogram
hist(p.value,main=paste("Within-classroom correlation:",correlation),xlab="p-value",cex.main=2,cex.lab=2,cex.axis=2)
}

A: The problem would be that comparing the two schools this way mixes university level effects with classroom level effects. A mixed model would let you disentangle these. If you aren't interested in disentangling them, you should still take account of the clustered sampling (although many people fail to do this).
@Nico 's comment above gets to one problem here: Suppose one teacher in one school is really good, and he/she happens to be one of the teachers chosen?
But another problem is that the students in each class will be more similar to each other than they will be to other students in the same university in all sorts of ways: Different subjects draw different types of students by age, gender, experience, academic strength and weakness etc. 
A: There is nothing wrong with the test you described because you took a sample from both schools in a fair way. Dependent observations come into play when there is another variable on which the samples depend. I.e., in one of the schools only one class has shown up and you decided to take results from 50 people within this one class thinking it will be OK. But within the school result depends on a class, so you can't do it like this and it will give a wrong result which you can't detect by any statistical test... it is just a wrong experimental design. 
But I think people are talking about dependent observations from different point of view usually. It is when you think that you can derive distributions and errors from your samples based on assumptions of independence (most standard formulas assume that), while when your outcomes depend on each other those rules are not exact at all...
