A two-year-old and a six-year-old are both children by definition, but what appeals to one will not always appeal to the other. It is important to research what children in the age group you are writing to are interested in. Read books that are already in print for the subject matter and age group you want to write. Look at some of the children's books listed on the awards lists. Talk to a school librarian. You can study child psychology or go straight to the source and talk to a child. Find out what issues today's children are dealing with.
It is important to use vocabulary that is appropriate to the child's maturity and reading level. Some books are written for children who are reading below their reading level and for them you want to use simpler words. Part of reading is learning new vocabulary so do not be afraid to introduce a few big words in a children's book, but have a full understanding of that age group's average reading ability.
Your main character can be a child, animal, object or creature. What is most important is that the child somehow relate to the main character. Conflict is important so be sure to introduce a villain. Let your characters set a positive example for your child reader. Show them resolving issues and conflicts on their own with limited help from an adult or sibling.
Almost all children's books have illustrations but do not let this deter you if you are not an artist. Most publishers have illustrators they prefer to work with who will fill this role. Your focus is on the story.
Once you are done, ask others for feedback. Ask a parent to read the book to see if it is something she would want her child to read. Finally, ask a child to read it or read it to a group of children to get their feedback and ideas for improvement.