Is it illegal to use software for free?

Some shareware software allows to use it for so called trial version. Also some shareware software allows to use it during all time since it was installed, but you have read agreement to find out which conditions they apply. But the huge portion of shareware software does not allow to use it after trial period if it has it. And to have such software installed on your computer and use it is illegal.