While reading the Harry Potter series out of chronological order might not reveal major plot points or character developments, there are some intriguing Easter eggs and hidden references waiting to be discovered.
For instance, 'Short Stories from Hogwarts of Power, Politics and Pesky Poltergeists' features a mysterious book titled 'The Tales of Beedle the Bard' which contains spells and stories from the wizarding world. However, in the original publication of the series, this book was only mentioned in passing, and its contents weren't revealed until the companion volume 'The Tales of Beedle the Bard' was published in 2008.
Another example can be found in 'Fantastic Beasts and Where to Find Them', where a mysterious, ancient-looking tome is referenced as a possible lost book by Newt Scamander. This book has since been included in the companion guide of the same name.
These hidden references demonstrate that J.K. Rowling cleverly wove subtle connections throughout her series, even when reading out of chronological order.
As for the number of books in the series, to answer your question directly: there are seven main books, three companion volumes, and five spin-off books written by J.K. Rowling and other authors set within the Harry Potter universe.