Educational psychology is, to a large degree, an applied discipline. This means that it has two major types of aims. The first involves understanding of how people learn. This is pure scholarship, consisting of research and the publication of results. Secondly, though, unlike purely theoretical disciplines, educational psychology has a strong practical focus, concerned with improving education by applying the insights of psychology to it.
Educational psychology is concerned with learners as individuals from both cognitive and behavioral points of view. This distinguishes it from sociology, which considers learners primarily as members of groups (such as ethnic, religious, or economic groups). Educational psychology is scientific in nature. Rather than being grounded simply in the pragmatics of educators' experiences, it attempts to use general theories about human nature and development to explain how people learn.
The field has a long history, going back to ancient Greece and Rome. One important and consistent element of the discipline is that it argues that our pedagogical methods should be grounded in what we know about cognitive development, with pedagogical methods being age-appropriate. Educational psychology can focus on how to optimize learning but also studies failures in learning and addresses how they can be remedied. It can focus on "average," gifted, or exceptional students, or students with various learning disabilities.
The way education is related to psychology is that educators can be most effective when they understand various elements of learners' psychology and apply that knowledge to their teaching methods.