Warning: Spoilers follow
Hedwig is a gift to Harry from Hagrid in the first book of the series, purchased in Diagon Alley while shopping for supplies for Harry's first year at Hogwarts. In the series, owls are used by witches and wizards primarily as message and package couriers (though rats, toads and cats are also acceptable for this purpose), so Hedwig is used for messages throughout the series. Keeping Hedwig at home during summer break continues to be just one more area of conflict between Harry and his muggle guardian aunt and uncle.
Harry seems connected to Hedwig, as a usual pet owner would be. In fact, during the fifth book in the series, Harry becomes sorry at being irritable with him, and also is with him when lonely.
In Book 5, Hedwig is injured by thestrals while carrying a message between Harry and Sirius Black. It was never clearly stated as to what exactly was responsible for the attack on Hedwig, but Dolores Umbridge was suspected later in the book when she began inspecting in and out going letters.