These are really not necessarily three different things. A democracy, a republic, and a federation are not different things in the sense that a car, a tree, and a ball are. Instead, the three are different in the sense that a car, a sports car, and a Mercedes are different things. Let us examine why this is so.
A democracy and a republic are essentially the same thing. In theory, there are some differences between the two, but in practice in the modern world, they are the same thing. In theory a democracy is a system in which the people have direct control over the government. The people are able, therefore, to enact whatever kinds of laws they want to enact. In a republic, the people have less control over the government. For example, there can be a constitution that limits the sorts of laws that the government can make. These are important differences, but there are not really any examples of democracies (using this definition) in our world today. Therefore, it is reasonable to say that a democracy and a republic are theoretically different but functionally identical.
A federation is one sort of a democracy. In a federation, the various parts of the country (different states or provinces) have certain levels of rights. For example, in the United States, the national government cannot tell all the states to set their income taxes at a given level. The national government cannot tell the states to lower their minimum wages. The states have rights that the national government cannot take away. This is different from a unitary government in which the national government does not have to respect the rights of the states.